首页 > 其他分享 >关于Could not autowire. No beans of 'xxxx' type found. 解决方法之一

关于Could not autowire. No beans of 'xxxx' type found. 解决方法之一

时间:2023-03-23 19:57:36浏览次数:42  
标签:xxxx autowire No Could beans type

关于Could not autowire. No beans of 'xxxx' type found. 解决方法之一

原因:启动类与配置类是在一个包下 但是不同包 而且配置类也不是子包 启动类没扫描到配置类

这时候有两种解决方案
第一种需要在Springboot启动类上添加@ComponentScan(basePackages = {"包名"})

第二种直接将启动类挪到外面的父包下

标签:xxxx,autowire,No,Could,beans,type
From: https://www.cnblogs.com/zhouyeshan/p/17248659.html

相关文章