Skip to content

Commit bc35723

Browse files
author
YunaiV
committed
增加 Consul 入门
1 parent 3b58d9e commit bc35723

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
spring:
22
application:
33
name: demo-consumer # Spring 应用名
4+
45
cloud:
5-
zookeeper:
6-
connect-string: 127.0.0.1:2181
7-
# Zookeeper 作为注册中心的配置项,对应 ZookeeperDiscoveryProperties 配置类
6+
# Spring Cloud Consul 通用配置项,对应 ConsulProperties 类
7+
consul:
8+
host: 127.0.0.1 # Consul 主机
9+
port: 8500 # Consul 端口
10+
# Spring Cloud Consul Discovery 配置项,对应 ConsulDiscoveryProperties 类
811
discovery:
9-
root: /services # Zookeeper 数据存储的根节点,默认为 /services
12+
service-name: ${spring.application.name} # 注册到 Consul 的服务名,默认为 `spring.application.name` 配置项
13+
health-check-path: /actuator/health # 健康检查的接口,默认为 /actuator/health,由 Spring Boot Actuator 提供
1014

1115
server:
1216
port: 28080 # 服务器端口。默认为 8080

labx-27/labx-27-sc-consul-discovery-demo01-provider/src/main/resources/application.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ spring:
99
# Spring Cloud Consul Discovery 配置项,对应 ConsulDiscoveryProperties 类
1010
discovery:
1111
service-name: ${spring.application.name} # 注册到 Consul 的服务名,默认为 `spring.application.name` 配置项
12+
health-check-path: /actuator/health # 健康检查的接口,默认为 /actuator/health,由 Spring Boot Actuator 提供
1213

1314
server:
1415
port: 18080 # 服务器端口。默认为 8080
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<http://www.iocoder.cn/Spring-Cloud/Consul-Discovery/?github>

0 commit comments

Comments
 (0)