异常:
springframework.beans.factory.BeanDefinitionStoreException: Failed to
parse configuration class [com.itcodai.course01.Course01Application];
nested exception is
org.springframework.context.annotation.ConflictingBeanDefinitionException:Annotation-specified bean name ‘testController’ for bean class
[com.itcodai.course01.Swagger2Test.TestController] conflicts with
existing, non-compatible bean definition of same name and class
[com.itcodai.course01.MVCTest.TestController]
情景:
项目新增一个类之后,项目就报错了。但出错比较容易找。
原因:
类重命名问题。然后对照我的项目中的注解,果然是新增的TestController类重名了。
本文详细解析了SpringBoot项目中因类名重复导致的BeanDefinitionStoreException异常,阐述了异常的根本原因,并提供了检查与解决类重名问题的具体步骤。

2万+

被折叠的 条评论
为什么被折叠?



