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. 这个时候基本上就可以实现自动装配了。

原文地址:https://www.cnblogs.com/gobyte/p/10779506.html