mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 21:57:56 +08:00
Merge branch 'develop' into registry-nacos
# Conflicts: # sop-gateway/src/main/resources/application-dev.yml
This commit is contained in:
@@ -45,9 +45,6 @@ SOP封装了开放平台大部分功能包括:签名验证、统一异常处
|
||||
- 应用授权
|
||||
- 监控日志
|
||||
|
||||
## 后期规划
|
||||
|
||||
- 调试工具
|
||||
|
||||
## admin界面预览
|
||||
|
||||
|
@@ -1,5 +1,10 @@
|
||||
# changelog
|
||||
|
||||
## 1.12.0
|
||||
|
||||
- admin后台新增角色管理
|
||||
- 支持nacos作为注册中心
|
||||
|
||||
## 1.11.0
|
||||
|
||||
- 秘钥管理改造
|
||||
|
@@ -1,30 +1,31 @@
|
||||
* [首页](/?t=1561970396914)
|
||||
* [首页](/?t=1561975674071)
|
||||
* 开发文档
|
||||
* [快速体验](files/10010_快速体验.md?t=1561970396914)
|
||||
* [项目接入到SOP](files/10011_项目接入到SOP.md?t=1561970396931)
|
||||
* [新增接口](files/10020_新增接口.md?t=1561970396931)
|
||||
* [业务参数校验](files/10030_业务参数校验.md?t=1561970396931)
|
||||
* [错误处理](files/10040_错误处理.md?t=1561970396931)
|
||||
* [编写文档](files/10041_编写文档.md?t=1561970396931)
|
||||
* [接口交互详解](files/10050_接口交互详解.md?t=1561970396931)
|
||||
* [easyopen支持](files/10070_easyopen支持.md?t=1561970396932)
|
||||
* [使用签名校验工具](files/10080_使用签名校验工具.md?t=1561970396932)
|
||||
* [ISV管理](files/10085_ISV管理.md?t=1561970396932)
|
||||
* [自定义路由](files/10086_自定义路由.md?t=1561970396932)
|
||||
* [路由授权](files/10090_路由授权.md?t=1561970396932)
|
||||
* [接口限流](files/10092_接口限流.md?t=1561970396932)
|
||||
* [监控日志](files/10093_监控日志.md?t=1561970396932)
|
||||
* [SDK开发](files/10095_SDK开发.md?t=1561970396932)
|
||||
* [使用SpringCloudGateway](files/10096_使用SpringCloudGateway.md?t=1561970396932)
|
||||
* [应用授权](files/10097_应用授权.md?t=1561970396932)
|
||||
* [更改数据节点名称](files/10099_更改数据节点名称.md?t=1561970396932)
|
||||
* [对接前端](files/10100_对接前端.md?t=1561970396933)
|
||||
* [自定义过滤器](files/10102_自定义过滤器.md?t=1561970396933)
|
||||
* [文件上传](files/10104_文件上传.md?t=1561970396933)
|
||||
* [nacos注册中心](files/10106_nacos注册中心.md?t=1561970396933)
|
||||
* [快速体验](files/10010_快速体验.md?t=1561975674073)
|
||||
* [项目接入到SOP](files/10011_项目接入到SOP.md?t=1561975674089)
|
||||
* [新增接口](files/10020_新增接口.md?t=1561975674089)
|
||||
* [业务参数校验](files/10030_业务参数校验.md?t=1561975674090)
|
||||
* [错误处理](files/10040_错误处理.md?t=1561975674090)
|
||||
* [编写文档](files/10041_编写文档.md?t=1561975674090)
|
||||
* [接口交互详解](files/10050_接口交互详解.md?t=1561975674090)
|
||||
* [easyopen支持](files/10070_easyopen支持.md?t=1561975674090)
|
||||
* [使用签名校验工具](files/10080_使用签名校验工具.md?t=1561975674090)
|
||||
* [ISV管理](files/10085_ISV管理.md?t=1561975674090)
|
||||
* [自定义路由](files/10086_自定义路由.md?t=1561975674090)
|
||||
* [路由授权](files/10090_路由授权.md?t=1561975674090)
|
||||
* [接口限流](files/10092_接口限流.md?t=1561975674090)
|
||||
* [监控日志](files/10093_监控日志.md?t=1561975674091)
|
||||
* [SDK开发](files/10095_SDK开发.md?t=1561975674091)
|
||||
* [使用SpringCloudGateway](files/10096_使用SpringCloudGateway.md?t=1561975674091)
|
||||
* [应用授权](files/10097_应用授权.md?t=1561975674091)
|
||||
* [更改数据节点名称](files/10099_更改数据节点名称.md?t=1561975674091)
|
||||
* [对接前端](files/10100_对接前端.md?t=1561975674091)
|
||||
* [自定义过滤器](files/10102_自定义过滤器.md?t=1561975674091)
|
||||
* [文件上传](files/10104_文件上传.md?t=1561975674091)
|
||||
* [nacos注册中心](files/10106_nacos注册中心.md?t=1561975674091)
|
||||
* [扩展其它注册中心](files/10107_扩展其它注册中心.md?t=1561975674091)
|
||||
* 原理分析
|
||||
* [原理分析之@ApiMapping](files/90010_原理分析之@ApiMapping.md?t=1561970396933)
|
||||
* [原理分析之路由存储](files/90011_原理分析之路由存储.md?t=1561970396933)
|
||||
* [原理分析之如何路由](files/90012_原理分析之如何路由.md?t=1561970396933)
|
||||
* [原理分析之文档归纳](files/90013_原理分析之文档归纳.md?t=1561970396933)
|
||||
* [常见问题](files/90100_常见问题.md?t=1561970396933)
|
||||
* [原理分析之@ApiMapping](files/90010_原理分析之@ApiMapping.md?t=1561975674092)
|
||||
* [原理分析之路由存储](files/90011_原理分析之路由存储.md?t=1561975674092)
|
||||
* [原理分析之如何路由](files/90012_原理分析之如何路由.md?t=1561975674092)
|
||||
* [原理分析之文档归纳](files/90013_原理分析之文档归纳.md?t=1561975674092)
|
||||
* [常见问题](files/90100_常见问题.md?t=1561975674092)
|
||||
|
@@ -1,55 +1,28 @@
|
||||
# nacos注册中心
|
||||
|
||||
完整代码在`registry-nacos`分支
|
||||
使用nacos作为注册中心,步骤如下:
|
||||
|
||||
SOP默认使用eureka注册中心,如果要换成nacos注册中心,步骤如下:
|
||||
- 准备工作
|
||||
|
||||
- 实现`com.gitee.sop.registryapi.service.RegistryService`接口
|
||||
1.安装nacos,前往[最新稳定版本](https://github.com/alibaba/nacos/releases),下载最新版nacos
|
||||
|
||||
1.找到`SOP/sop-common/sop-registry-api`工程,在service.impl包下新建一个类,实现RegistryService接口
|
||||
2.启动nacos服务器,cd nacos/bin
|
||||
|
||||
```java
|
||||
public class RegistryServiceNacos implements RegistryService {
|
||||
Linux/Unix/Mac,启动命令(standalone代表着单机模式运行,非集群模式):
|
||||
|
||||
@Override
|
||||
public List<ServiceInfo> listAllService(int pageNo, int pageSize) throws Exception {
|
||||
// TODO: 返回服务实例
|
||||
}
|
||||
`sh startup.sh -m standalone`
|
||||
|
||||
@Override
|
||||
public void onlineInstance(ServiceInstance serviceInstance) throws Exception {
|
||||
// TODO: 实例上线
|
||||
}
|
||||
Windows,启动命令:
|
||||
|
||||
@Override
|
||||
public void offlineInstance(ServiceInstance serviceInstance) throws Exception {
|
||||
// TODO: 实例下线
|
||||
}
|
||||
}
|
||||
```
|
||||
`cmd startup.cmd`
|
||||
|
||||
2.在`com.gitee.sop.registryapi.config.BaseRegistryConfig`中新增
|
||||
|
||||
```java
|
||||
/**
|
||||
* 当配置了registry.name=nacos生效
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnProperty(prefix = "registry", name = "name", havingValue = "nacos")
|
||||
RegistryService registryServiceNacos() {
|
||||
return new RegistryServiceNacos();
|
||||
}
|
||||
```
|
||||
|
||||
其中`@ConditionalOnProperty(prefix = "registry", name = "name", havingValue = "nacos")`
|
||||
表示`application.properties`配置了`registry.name=nacos`参数才能生效,registry.name=nacos下文会讲到。
|
||||
或者双击startup.cmd运行文件。
|
||||
|
||||
更多访问:https://nacos.io/zh-cn/docs/quick-start.html
|
||||
|
||||
- 微服务端修改
|
||||
|
||||
1.修改微服务应用pom.xml,注释eureka服务发现依赖,添加nacos服务发现依赖
|
||||
1.修改微服务应用pom,打开`sop-example/sop-story/sop-story-web/pom.xml`,注释eureka服务发现依赖,添加nacos服务发现依赖
|
||||
|
||||
```xml
|
||||
<!-- 注册中心【只能用一个,不用的注释掉】 -->
|
||||
@@ -90,15 +63,16 @@ spring:
|
||||
- SOP-admin修改
|
||||
|
||||
|
||||
修改yml文件,新增nacos服务器地址,`registry.name`填nacos
|
||||
修改yml文件,设置nacos服务器地址,`registry.name`填nacos
|
||||
|
||||
```yaml
|
||||
# 注册中心地址,根据实际情况改,这里只是参数,并不会去注册
|
||||
registry:
|
||||
# 使用哪个配置中心,使用eureka,填eureka;使用nacos填nacos
|
||||
name: nacos
|
||||
eureka-server-addr: http://localhost:1111/eureka/
|
||||
# nacos服务器地址
|
||||
nacos-server-addr: 127.0.0.1:8848
|
||||
# 使用eureka,填:eureka,使用nacos填:nacos
|
||||
name: nacos
|
||||
```
|
||||
|
||||
- website-server修改
|
||||
@@ -110,4 +84,5 @@ registry:
|
||||
- 参考资料
|
||||
|
||||
1.[nacos介绍及安装](https://nacos.io/zh-cn/docs/quick-start.html)
|
||||
|
||||
2.[nacos spring cloud注册发现](https://nacos.io/zh-cn/docs/quick-start-spring-cloud.html)
|
||||
|
112
doc/docs/files/10107_扩展其它注册中心.md
Normal file
112
doc/docs/files/10107_扩展其它注册中心.md
Normal file
@@ -0,0 +1,112 @@
|
||||
# 扩展其它注册中心
|
||||
|
||||
**注: nacos注册中心已经实现,本篇以nacos为例介绍如何扩展,如果要改成consul,可按照此方式进行修改**
|
||||
|
||||
SOP默认使用eureka注册中心,如果要换成nacos注册中心,步骤如下:
|
||||
|
||||
- 实现`com.gitee.sop.registryapi.service.RegistryService`接口
|
||||
|
||||
1.找到`SOP/sop-common/sop-registry-api`工程,在service.impl包下新建一个类,实现RegistryService接口
|
||||
|
||||
```java
|
||||
public class RegistryServiceNacos implements RegistryService {
|
||||
|
||||
@Override
|
||||
public List<ServiceInfo> listAllService(int pageNo, int pageSize) throws Exception {
|
||||
// TODO: 返回服务实例
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onlineInstance(ServiceInstance serviceInstance) throws Exception {
|
||||
// TODO: 实例上线
|
||||
}
|
||||
|
||||
@Override
|
||||
public void offlineInstance(ServiceInstance serviceInstance) throws Exception {
|
||||
// TODO: 实例下线
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
2.在`com.gitee.sop.registryapi.config.BaseRegistryConfig`中新增
|
||||
|
||||
```java
|
||||
/**
|
||||
* 当配置了registry.name=nacos生效
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnProperty(prefix = "registry", name = "name", havingValue = "nacos")
|
||||
RegistryService registryServiceNacos() {
|
||||
return new RegistryServiceNacos();
|
||||
}
|
||||
```
|
||||
|
||||
其中`@ConditionalOnProperty(prefix = "registry", name = "name", havingValue = "nacos")`
|
||||
表示`application.properties`配置了`registry.name=nacos`参数才能生效,registry.name=nacos下文会讲到。
|
||||
|
||||
|
||||
- 微服务端修改
|
||||
|
||||
1.修改微服务应用pom.xml,注释eureka服务发现依赖,添加nacos服务发现依赖
|
||||
|
||||
```xml
|
||||
<!-- 注册中心【只能用一个,不用的注释掉】 -->
|
||||
<!-- 使用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 -->
|
||||
```
|
||||
|
||||
2.yml文件新增nacos配置,并注释掉eureka相关配置
|
||||
|
||||
```yaml
|
||||
spring:
|
||||
cloud:
|
||||
# nacos注册中心,和eureka只能用一个
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: 127.0.0.1:8848
|
||||
```
|
||||
|
||||
- 网关修改
|
||||
|
||||
找到`sop-gateway`工程,步骤同上
|
||||
|
||||
- SOP-admin修改
|
||||
|
||||
|
||||
修改yml文件,新增nacos服务器地址,`registry.name`填nacos
|
||||
|
||||
```yaml
|
||||
# 注册中心地址,根据实际情况改,这里只是参数,并不会去注册
|
||||
registry:
|
||||
# 使用eureka,填:eureka,使用nacos填:nacos
|
||||
name: nacos
|
||||
eureka-server-addr: http://localhost:1111/eureka/
|
||||
nacos-server-addr: 127.0.0.1:8848
|
||||
```
|
||||
|
||||
- website-server修改
|
||||
|
||||
步骤同`SOP-admin修改`
|
||||
|
||||
- 参考资料
|
||||
|
||||
1.[nacos介绍及安装](https://nacos.io/zh-cn/docs/quick-start.html)
|
||||
|
||||
2.[nacos spring cloud注册发现](https://nacos.io/zh-cn/docs/quick-start-spring-cloud.html)
|
@@ -30,7 +30,7 @@
|
||||
<dependency>
|
||||
<groupId>com.gitee.sop</groupId>
|
||||
<artifactId>sop-registry-api</artifactId>
|
||||
<version>1.11.0-SNAPSHOT</version>
|
||||
<version>1.12.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!-- easyopen starter -->
|
||||
|
@@ -9,11 +9,6 @@ public class SopAdminConstants {
|
||||
*/
|
||||
public static final String SOP_SERVICE_ROUTE_PATH = "/com.gitee.sop.route";
|
||||
|
||||
/**
|
||||
* zookeeper存放路由授权信息根目录
|
||||
*/
|
||||
public static final String SOP_ROUTE_PERMISSION_PATH = "/com.gitee.sop.isv.route.permission";
|
||||
|
||||
/**
|
||||
* 消息监听路径
|
||||
*/
|
||||
|
@@ -20,7 +20,6 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static com.gitee.sop.adminserver.bean.SopAdminConstants.SOP_MSG_CHANNEL_PATH;
|
||||
import static com.gitee.sop.adminserver.bean.SopAdminConstants.SOP_ROUTE_PERMISSION_PATH;
|
||||
|
||||
/**
|
||||
* @author tanghc
|
||||
@@ -77,10 +76,6 @@ public class ZookeeperContext {
|
||||
return serviceIdPath + "/" + routeId;
|
||||
}
|
||||
|
||||
public static String getRoutePermissionPath() {
|
||||
return SOP_ROUTE_PERMISSION_PATH;
|
||||
}
|
||||
|
||||
public static String getIsvInfoChannelPath() {
|
||||
return SOP_MSG_CHANNEL_PATH + "/isvinfo";
|
||||
}
|
||||
|
@@ -35,9 +35,10 @@ easyopen:
|
||||
# 注册中心地址,根据实际情况改,这里只是参数,并不会去注册
|
||||
registry:
|
||||
eureka-server-addr: http://localhost:1111/eureka/
|
||||
# nacos服务器地址
|
||||
nacos-server-addr: 127.0.0.1:8848
|
||||
# 使用哪个配置中心,使用eureka,填eureka;使用nacos填nacos
|
||||
name: nacos
|
||||
# 使用eureka,填:eureka,使用nacos填:nacos
|
||||
name: eureka
|
||||
|
||||
|
||||
# 根据实际情况改
|
||||
|
@@ -5,7 +5,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.gitee.sop</groupId>
|
||||
<artifactId>sop-common</artifactId>
|
||||
<version>1.11.0-SNAPSHOT</version>
|
||||
<version>1.12.0-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<properties>
|
||||
|
@@ -5,11 +5,11 @@
|
||||
<parent>
|
||||
<groupId>com.gitee.sop</groupId>
|
||||
<artifactId>sop-common</artifactId>
|
||||
<version>1.11.0-SNAPSHOT</version>
|
||||
<version>1.12.0-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<artifactId>sop-gateway-common</artifactId>
|
||||
<version>1.11.0-SNAPSHOT</version>
|
||||
<version>1.12.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>sop-gateway-common</name>
|
||||
|
@@ -45,11 +45,6 @@ public class SopConstants {
|
||||
*/
|
||||
public static final String SOP_SERVICE_ROUTE_PATH = "/com.gitee.sop.route";
|
||||
|
||||
/**
|
||||
* zookeeper存放路由授权信息根目录
|
||||
*/
|
||||
public static final String SOP_ROUTE_PERMISSION_PATH = "/com.gitee.sop.isv.route.permission";
|
||||
|
||||
/**
|
||||
* 消息监听路径
|
||||
*/
|
||||
|
@@ -18,7 +18,6 @@ import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import static com.gitee.sop.gatewaycommon.bean.SopConstants.SOP_MSG_CHANNEL_PATH;
|
||||
import static com.gitee.sop.gatewaycommon.bean.SopConstants.SOP_ROUTE_PERMISSION_PATH;
|
||||
import static com.gitee.sop.gatewaycommon.bean.SopConstants.SOP_SERVICE_ROUTE_PATH;
|
||||
|
||||
/**
|
||||
@@ -60,10 +59,6 @@ public class ZookeeperContext {
|
||||
return SOP_SERVICE_ROUTE_PATH;
|
||||
}
|
||||
|
||||
public static String getRoutePermissionPath() {
|
||||
return SOP_ROUTE_PERMISSION_PATH;
|
||||
}
|
||||
|
||||
public static String getIsvInfoChannelPath() {
|
||||
return SOP_MSG_CHANNEL_PATH + "/isvinfo";
|
||||
}
|
||||
|
@@ -5,7 +5,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.gitee.sop</groupId>
|
||||
<artifactId>sop-registry-api</artifactId>
|
||||
<version>1.11.0-SNAPSHOT</version>
|
||||
<version>1.12.0-SNAPSHOT</version>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
@@ -6,11 +6,11 @@
|
||||
<parent>
|
||||
<groupId>com.gitee.sop</groupId>
|
||||
<artifactId>sop-common</artifactId>
|
||||
<version>1.11.0-SNAPSHOT</version>
|
||||
<version>1.12.0-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<artifactId>sop-service-common</artifactId>
|
||||
<version>1.11.0-SNAPSHOT</version>
|
||||
<version>1.12.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>sop-service-common</name>
|
||||
|
@@ -26,7 +26,7 @@
|
||||
<dependency>
|
||||
<groupId>com.gitee.sop</groupId>
|
||||
<artifactId>sop-service-common</artifactId>
|
||||
<version>1.11.0-SNAPSHOT</version>
|
||||
<version>1.12.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
|
@@ -24,7 +24,7 @@
|
||||
<dependency>
|
||||
<groupId>com.gitee.sop</groupId>
|
||||
<artifactId>sop-service-common</artifactId>
|
||||
<version>1.11.0-SNAPSHOT</version>
|
||||
<version>1.12.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.gitee.sop</groupId>
|
||||
@@ -39,22 +39,23 @@
|
||||
|
||||
|
||||
<!-- 注册中心【只能用一个,不用的注释掉】 -->
|
||||
<!-- 使用eureka注册中心
|
||||
<!-- 使用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 -->
|
||||
|
||||
|
||||
|
@@ -11,15 +11,15 @@ spring:
|
||||
connect-string: localhost:2181
|
||||
|
||||
# nacos注册中心,和eureka只能用一个
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: 127.0.0.1:8848
|
||||
# nacos:
|
||||
# discovery:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
|
||||
# eureka注册中心,如果使用nacos注册中心,这里要注释掉
|
||||
#eureka:
|
||||
# client:
|
||||
# serviceUrl:
|
||||
# defaultZone: http://localhost:1111/eureka/
|
||||
eureka:
|
||||
client:
|
||||
serviceUrl:
|
||||
defaultZone: http://localhost:1111/eureka/
|
||||
|
||||
# dubbo consumer
|
||||
demo:
|
||||
|
@@ -29,7 +29,7 @@
|
||||
<dependency>
|
||||
<groupId>com.gitee.sop</groupId>
|
||||
<artifactId>sop-service-common</artifactId>
|
||||
<version>1.11.0-SNAPSHOT</version>
|
||||
<version>1.12.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
|
@@ -20,7 +20,7 @@
|
||||
<dependency>
|
||||
<groupId>com.gitee.sop</groupId>
|
||||
<artifactId>sop-service-common</artifactId>
|
||||
<version>1.11.0-SNAPSHOT</version>
|
||||
<version>1.12.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<!-- eureka 服务发现 -->
|
||||
<dependency>
|
||||
|
@@ -24,7 +24,7 @@
|
||||
<dependency>
|
||||
<groupId>com.gitee.sop</groupId>
|
||||
<artifactId>sop-service-common</artifactId>
|
||||
<version>1.11.0-SNAPSHOT</version>
|
||||
<version>1.12.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.gitee.sop</groupId>
|
||||
@@ -33,22 +33,23 @@
|
||||
</dependency>
|
||||
|
||||
<!-- 注册中心【只能用一个,不用的注释掉】 -->
|
||||
<!-- 使用eureka注册中心
|
||||
<!-- 使用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 -->
|
||||
|
||||
<dependency>
|
||||
|
@@ -11,15 +11,15 @@ spring:
|
||||
connect-string: localhost:2181
|
||||
|
||||
# nacos注册中心,和eureka只能用一个
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: 127.0.0.1:8848
|
||||
# nacos:
|
||||
# discovery:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
|
||||
# eureka注册中心,如果使用nacos注册中心,这里要注释掉
|
||||
#eureka:
|
||||
# client:
|
||||
# serviceUrl:
|
||||
# defaultZone: http://localhost:1111/eureka/
|
||||
eureka:
|
||||
client:
|
||||
serviceUrl:
|
||||
defaultZone: http://localhost:1111/eureka/
|
||||
|
||||
# dubbo provider
|
||||
dubbo:
|
||||
|
@@ -23,7 +23,7 @@
|
||||
<dependency>
|
||||
<groupId>com.gitee.sop</groupId>
|
||||
<artifactId>sop-gateway-common</artifactId>
|
||||
<version>1.11.0-SNAPSHOT</version>
|
||||
<version>1.12.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!-- ↓↓↓ 使用spring cloud zuul ↓↓↓ -->
|
||||
@@ -66,22 +66,23 @@
|
||||
</dependency>
|
||||
|
||||
<!-- 注册中心【只能用一个,不用的注释掉】 -->
|
||||
<!-- 使用eureka注册中心
|
||||
<!-- 使用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 -->
|
||||
|
@@ -25,7 +25,7 @@
|
||||
<dependency>
|
||||
<groupId>com.gitee.sop</groupId>
|
||||
<artifactId>sop-registry-api</artifactId>
|
||||
<version>1.11.0-SNAPSHOT</version>
|
||||
<version>1.12.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
@@ -3,10 +3,11 @@ server:
|
||||
|
||||
# 注册中心地址,根据实际情况改,这里只是参数,并不会去注册
|
||||
registry:
|
||||
# 使用哪个配置中心,使用eureka,填eureka;使用nacos填nacos
|
||||
name: nacos
|
||||
eureka-server-addr: http://localhost:1111/eureka/
|
||||
# nacos服务器地址
|
||||
nacos-server-addr: 127.0.0.1:8848
|
||||
# 使用eureka,填:eureka,使用nacos填:nacos
|
||||
name: eureka
|
||||
|
||||
spring:
|
||||
application:
|
||||
|
Reference in New Issue
Block a user