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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM