eureka迁移nacos 出现双注册中心

步骤

  1. 启动nacos服务
  2. 从项目中注释掉spring-cloud-starter-eureka,或者netflix的eureka相关依赖 (如未完全注释,出现下面异常)
  3. 引入nacos依赖
  4. 修改配置文件,启动项目

未完全注释eureka依赖
Field registration in org.springframework.cloud.client.serviceregistry.ServiceRegistryAutoConfiguration$ServiceRegistryEndpointConfiguration required a single bean, but 2 were found:

  • nacosRegistration: defined by method 'nacosRegistration' in class path resource [org/springframework/cloud/alibaba/nacos/NacosDiscoveryAutoConfiguration.class]

  • eurekaRegistration: defined in BeanDefinition defined in class path resource [org/springframework/cloud/netflix/eureka/EurekaClientAutoConfiguration$RefreshableEurekaClientConfiguration.class]

原因在于eureka的maven依赖还在,如果使用idea工具,用maven helper插件打开项目maven依赖图,搜索eureka找到项目在哪里依赖了eureka-client,注释掉即可。

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容