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

相关推荐
风起洛阳@不良使16 小时前
springIOC创建对象的方式--spring容器中的注入
java·spring
Flittly20 小时前
【AgentScope Java新手村系列】(20)文字转语音TTS
java·spring boot·spring
重生之我是Java开发战士21 小时前
【Java EE】Spring IoC 与 DI
java·spring·java-ee
ruleslol1 天前
Spring11-校验框架:@Valid VS @Validated
spring
_waylau1 天前
Spring Framework HTTP服务客户端详解
java·后端·网络协议·spring·http·spring cloud
tryxr1 天前
Spring Cloud eureka
spring·spring cloud·eureka
空中湖1 天前
Spring AI RAG 完整实战:从零搭建企业知识库问答系统
java·人工智能·spring
sun03222 天前
【笔记】Spring MVC 相关介绍
java·spring·mvc
XS0301062 天前
Spring AI 第二课-流式输出 & 运行时动态参数配置
java·人工智能·spring
额恩662 天前
阶段五:HttpOnly Cookie 登录持久化
java·spring