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,怀疑是版本冲突,去掉后问题修复。

相关推荐
daidaidaiyu9 小时前
Spring IOC 源码学习 声明式事务的入口点
java·spring
森林里的程序猿猿11 小时前
Spring Aop底层源码实现(一)
java·后端·spring
攒了一袋星辰12 小时前
SequenceGenerator高并发有序顺序号生成中间件 - 架构设计文档
java·后端·spring·中间件·架构·kafka·maven
大傻^14 小时前
LangChain4j Spring Boot Starter:自动配置与声明式 Bean 管理
java·人工智能·spring boot·spring·langchain4j
yhole14 小时前
springboot 修复 Spring Framework 特定条件下目录遍历漏洞(CVE-2024-38819)
spring boot·后端·spring
大傻^14 小时前
Spring AI 2.0 MCP 协议实战:Model Context Protocol SDK 与多服务器编排
服务器·人工智能·spring
l软件定制开发工作室14 小时前
Spring开发系列教程(34)——打包Spring Boot应用
java·spring boot·后端·spring·springboot
0xDevNull14 小时前
Spring Boot 循环依赖解决方案完全指南
java·开发语言·spring
随风,奔跑14 小时前
Spring MVC
java·后端·spring
弦有三种苦难15 小时前
CCF-202412-T3缓存模拟90分
java·开发语言·spring