解决idea启动报错:Consider defining a bean of type ‘com.service.applicant.Applicant‘ in your configuration. 短命女 2024-03-31 14:27 13阅读 0赞 idea在启动时,报错:报错日志为 *************************** APPLICATION FAILED TO START *************************** Description: Parameter 0 of method setApplicant in webService.controller.RequestController required a bean of type 'com.service.applicant.Applicant' that could not be found. Action: Consider defining a bean of type 'com.service.applicant.Applicant' in your configuration. ## 解决方法 ## 在启动类上面加上如下注解,添加的内容视具体是哪一个bean而定 @SpringBootApplication // 添加没有扫描到的bean的路径 @ComponentScan({ "com.service"}) // 如果引入的包不是本项目的,那么还需要再加一行扫描自己项目的bean @ComponentScan({ "com.abc"}) public class WebServiceApplication { // ..... }
还没有评论,来说两句吧...