spring cloud eureka 初始化报错(A bean with that name has already been defined)

报错内容

The bean 'eurekaRegistration', defined in class path resource [org/springframework/cloud/netflix/eureka/EurekaClientAutoConfiguration E u r e k a C l i e n t C o n f i g u r a t i o n . c l a s s ] , c o u l d n o t b e r e g i s t e r e d . A b e a n w i t h t h a t n a m e h a s a l r e a d y b e e n d e f i n e d i n c l a s s p a t h r e s o u r c e [ o r g / s p r i n g f r a m e w o r k / c l o u d / n e t f l i x / e u r e k a / E u r e k a C l i e n t A u t o C o n f i g u r a t i o n EurekaClientConfiguration.class], could not be registered. A bean with that name has already been defined in class path resource [org/springframework/cloud/netflix/eureka/EurekaClientAutoConfiguration EurekaClientConfiguration.class],couldnotberegistered.Abeanwiththatnamehasalreadybeendefinedinclasspathresource[org/springframework/cloud/netflix/eureka/EurekaClientAutoConfigurationRefreshableEurekaClientConfiguration.class] and overriding is disabled.

排查

原因大概就是依赖冲突、版本冲突之类的,根据以下答案尝试后没有修复:

https://stackoverflow.com/questions/62868281/bean-eurekaregistration-defined-in-class-path-resource-could-not-be-registere

https://developer.baidu.com/article/details/3234921

https://www.volcengine.com/theme/8366164-OTHER-7-1

最后发现引用了 spring-cloud-context,怀疑是版本冲突,去掉后问题修复。

相关推荐
武子康1 小时前
Java-80 深入浅出 RPC Dubbo 动态服务降级:从雪崩防护到配置中心秒级生效
java·分布式·后端·spring·微服务·rpc·dubbo
心之语歌5 小时前
Spring AI MCP 客户端
人工智能·spring·github
Edingbrugh.南空5 小时前
Aerospike与Redis深度对比:从架构到性能的全方位解析
java·开发语言·spring
EmpressBoost10 小时前
谷粒商城170缓存序列化报错
java·spring·缓存
fouryears_2341711 小时前
@PathVariable与@RequestParam的区别
java·spring·mvc·springboot
萌新小白的逆袭11 小时前
《Maven 核心基础笔记(第一天)》
java·开发语言·spring
秋千码途11 小时前
小架构step系列26:Spring提供的validator
java·spring·架构
fouryears_2341712 小时前
什么是JSON,如何与Java对象转化
java·spring boot·spring·json
Code季风16 小时前
Spring AOP 与事务管理进阶:传播行为原理与实战指南
java·spring boot·spring
菠萝催学12316 小时前
日志配置Slf4j
java·数据库·spring·tomcat·maven·intellij-idea