mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 21:57:56 +08:00
nacos注册中心
This commit is contained in:
@@ -65,10 +65,24 @@
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- 注册中心【只能用一个,不用的注释掉】 -->
|
||||
<!-- 使用eureka注册中心
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
|
||||
</dependency>
|
||||
-->
|
||||
|
||||
<!-- 使用nacos注册中心
|
||||
版本 0.2.x.RELEASE 对应的是 Spring Boot 2.x 版本,版本 0.1.x.RELEASE 对应的是 Spring Boot 1.x 版本。
|
||||
https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-alibaba-nacos-discovery
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
<version>0.2.2.RELEASE</version>
|
||||
</dependency>
|
||||
<!-- 注册中心end -->
|
||||
|
||||
<!-- test -->
|
||||
<dependency>
|
||||
|
@@ -19,13 +19,6 @@ ribbon:
|
||||
# 请谨慎设置,因为post请求大多都是写入请求,如果要支持重试,确保服务的幂等性
|
||||
OkToRetryOnAllOperations: false
|
||||
|
||||
# 注册中心,根据实际情况修改
|
||||
eureka:
|
||||
serverAddr: localhost:1111
|
||||
client:
|
||||
serviceUrl:
|
||||
defaultZone: http://${eureka.serverAddr}/eureka/
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: api-gateway
|
||||
@@ -41,6 +34,16 @@ spring:
|
||||
lower-case-service-id: true
|
||||
enabled: true
|
||||
|
||||
# nacos注册中心,和eureka只能用一个
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: 127.0.0.1:8848
|
||||
|
||||
# eureka注册中心,如果使用nacos注册中心,这里要注释掉
|
||||
#eureka:
|
||||
# client:
|
||||
# serviceUrl:
|
||||
# defaultZone: http://localhost:1111/eureka/
|
||||
|
||||
# 数据源,根据实际情况修改
|
||||
datasource:
|
||||
|
Reference in New Issue
Block a user