springboot启动报错:Caused by: org.springframework.context.annotation.ConflictingBeanDefinitionException:

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这个包里面就不会报错。

原文地址:https://www.cnblogs.com/baichendongyang/p/13235500.html