标签:dad 导入 cat tar pid star web net tee
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-config-server</artifactId> </dependency>
package cn.jiedada; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.cloud.config.server.EnableConfigServer; import org.springframework.cloud.netflix.eureka.EnableEurekaClient; /** * @EnableConfigServer:开启配置中心 */ @SpringBootApplication @EnableEurekaClient @EnableConfigServer public class EurekaConfigService5000 { public static void main(String[] args) { new SpringApplicationBuilder(EurekaConfigService5000.class).web(true).run(args); } }
eureka: client: serviceUrl: defaultZone: http://localhost:1000/eureka/#注册中心地址 instance: ip-address: true #使用ip配置 instance-id: config-server #指定服务的id server: port: 5000 spring: application: name: config-server cloud: config: server: git: uri: https://gitee.com/huangruijiedada/springcloud_hrm.git #路径 username: password:
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-config-client</artifactId> </dependency>
把application.yml的优先级提高改为bootstrap.yml这样才可以
spring: cloud: config: uri: http://localhost:5000 #这里是我们自己配置的服务器端口 name: application-user2000 #这里是我们放在仓库中的名称application-user2000-dev.yml profile: dev #这里是环境 label: master
标签:dad 导入 cat tar pid star web net tee
原文地址:https://www.cnblogs.com/xiaoruirui/p/11961285.html