springboot启动类启动的时候报错:Caused by: org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name 'errorPageFilter' for bean class [org.springframework.boot.web.support.ErrorPageFilter] conflicts with existing, non-compatible bean definition of same name and class [org.springframework.boot.context.web.ErrorPageFilter]
并且有这个提示:
** WARNING ** : Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package.
这个是主要因为把启动类放在了顶级包Java里面,而没有重新创个包放。如下图,这样就会报错,如果放在baichen这个包里面就不会报错。

本文解析了SpringBoot启动类在顶级包中导致的ConflictingBeanDefinitionException错误,及如何通过调整包结构解决该问题。
1万+

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



