Skip to content

如何让Nepxion Discovery 6.x.x最新版本降级使用低版本的Spring Cloud Alibaba

HaojunRen edited this page May 31, 2024 · 2 revisions

由于Spring Cloud Alibaba从2.2.7.RELEASE升级成Nacos 2.x.x,导致Nacos Server为1.x.x的用户无法使用2.2.7.RELEASE,同时2.2.7.RELEASE相比2.2.6.RELEASE在某个内核构造类上有变更,导致Nepxion Discovery无法同时兼容2.2.7.RELEASE和2.2.6.RELEASE两个版本。整个升级线路上,Nepxion Discovery 6.12.x(含)以下版本支持Spring Cloud Alibaba 2.2.6.RELEASE(含)以下版本,Nepxion Discovery 6.13.x(含)以上版本支持Spring Cloud Alibaba 2.2.7.RELEASE(含)以上版本

那么,如果用户想使用Nepxion Discovery最新版本的功能,但又希望基于低版本的Spring Cloud Alibaba和Nacos,该如何降级?

下载最新代码

从GitHub或者Gitee下载最新源码

降级Spring Cloud Alibaba版本

打开根目录下的pom.xml,把

<spring.cloud.alibaba.version>2.2.7.RELEASE</spring.cloud.alibaba.version>

变更为

<spring.cloud.alibaba.version>2.2.6.RELEASE</spring.cloud.alibaba.version>

变更Nacos装饰类构造方法

  • 打开NacosServiceRegistryDecorator.java,把
public NacosServiceRegistryDecorator(NacosServiceManager nacosServiceManager, NacosDiscoveryProperties nacosDiscoveryProperties, NacosServiceRegistry serviceRegistry, ConfigurableApplicationContext applicationContext) {
    super(nacosServiceManager, nacosDiscoveryProperties);

变更为

public NacosServiceRegistryDecorator(NacosDiscoveryProperties nacosDiscoveryProperties, NacosServiceRegistry serviceRegistry, ConfigurableApplicationContext applicationContext) {
    super(nacosDiscoveryProperties);
  • 打开NacosApplicationContextInitializer.java,把
NacosServiceManager nacosServiceManager = applicationContext.getBean(NacosServiceManager.class);
NacosDiscoveryProperties nacosDiscoveryProperties = applicationContext.getBean(NacosDiscoveryProperties.class);

return new NacosServiceRegistryDecorator(nacosServiceManager, nacosDiscoveryProperties, nacosServiceRegistry, applicationContext);

变更为

NacosDiscoveryProperties nacosDiscoveryProperties = applicationContext.getBean(NacosDiscoveryProperties.class);

return new NacosServiceRegistryDecorator(nacosDiscoveryProperties, nacosServiceRegistry, applicationContext);

编译Nepxion Discovery

在根目录执行Maven命令,执行编译,并上传到公司的Maven仓库




2017-2050 ©Nepxion Studio Apache License

           

Total visits

讲义篇

集成篇

概念篇

实践篇

功能篇

配置篇

扩展篇

测试篇

升级篇

贡献篇

Clone this wiki locally