Spring Boot Autowirted注入找不到Bean对象解决方法

报错:Consider defining a bean of type 'xxxxxxxxxxxxx' in your configuration

1. 你应该在 ApplyApplication 启动类里,扫描你的 Service包,多包扫描方法如下

@SpringBootApplication(scanBasePackages = {"xx.xxx.apply.controller", "xx.xxx.apply.service.*", 
        "xx.xxx.apply.security.*"})

2. 你还需要在你的Service的实现类,注意!是实现类里添加注解 @service

3. 这个时候基本上就可以实现自动装配了。

posted @ 2019-04-27 17:42  山岚  阅读(4658)  评论(0编辑  收藏  举报