1.依赖
<!--引入consul--> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-consul-discovery</artifactId> </dependency> <!--引入健康检查--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> <!--引入config server--> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-config-server</artifactId> </dependency> <dependency> <groupId>org.tmatesoft.svnkit</groupId> <artifactId>svnkit</artifactId> </dependency>
2.配置文件
server.port=9999 spring.application.name=configserver spring.cloud.consul.host=localhost spring.cloud.consul.port=8500 spring.cloud.consul.discovery.service-name=${spring.application.name} spring.cloud.config.server.svn.uri=https://DESKTOP-VQE7HEH/svn/ems/ spring.cloud.config.server.svn.username=taohj spring.cloud.config.server.svn.password=taohj spring.cloud.config.server.default-label= spring.profiles.active=subversion
3.启动注解
@SpringBootApplication @EnableConfigServer public class ConfigserverApplication { public static void main(String[] args) { SpringApplication.run(ConfigserverApplication.class, args); } }