加入依赖
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zookeeper-discovery</artifactId>
</dependency>
添加配置
spring:
application:
name: zookeeper-demo
cloud:
zookeeper:
connect-string: 192.168.117.230:2181
server:
port: 9876
在springboot入口程序上注解,开启服务发现
@EnableDiscoveryClient