Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
[ERROR] [2019-04-21 23:38:36][org.springframework.boot.SpringApplication - 858]Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping]: Factory method 'requestMappingHandlerMapping' threw exception; nested exception is java.lang.NullPointerException
Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource

 

Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource

Springboot项目添加请求拦截时报错,网上查了好多都是版本问题或者jdbc.properties 上面不能有任何空格,但是无论怎么改就是不行,就是启动不了

原因是:springBoot无法扫描到@Configuration注解的配置类(令我非常纳闷,只要添加@Configuration注解就报错)

解决:使用@Configuration注解的配置类无法生效,后来查询资料得知,应该让启动类和config的包在同一级目录下