1、首先使用idea工具快速创建springboot工程,在pom.xml包中引入以下依懒
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
<version>2.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
<version>2.1.1.RELEASE</version>
</dependency>
2、其次在springboot启动类中,加入以下注解
@EnableEurekaClient
@EnableConfigServer
3、在resources下创建配置文件 application.yml中添加如下信息,需要在git服务器上创建服务的配置文件,配置文件名称是:
服务名称-dev | prd.yml
spring:
application:
name: config
cloud:
config:
server:
git:
uri: git地址
username: git账号
password: git密码
server:
prot: 7000
eureka:
client:
server-url:
defaultZone: http://localhost:8761/eureka
在springboot启动类中,启动即可。
167万+

被折叠的 条评论
为什么被折叠?



