一下载:Install | Consul | HashiCorp Developer
二开发者模式启动
consul agent -dev
三接口访问可视化页面 http://localhost:8500/
四.添加服务 Quick Start :: Spring Cloud Consul
pom引入
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-consul-discovery</artifactId> </dependency>
yml配置
spring:
cloud:
consul:
host: localhost
port: 8500
discovery:
service.name: ${spring.application.name}