SpringBoot配置consul
-
SpringBoot配置consul:pom
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-consul-discovery</artifactId> </dependency>
-
application.yml
server: port: 80 spring: application: name: cloud-consumer-order cloud: consul: # consul注册中心地址 host: localhost port: 8500 discovery: hostname: 127.0.0.1 service-name: ${spring.application.name}
-
启动入口文件
@SpringBootApplication @EnableDiscoveryClient public class OrderConsulMain80 { public static void main(String[] args) { SpringApplication.run(OrderConsulMain80.class,args); } }
脚踏实地,注重基础。