2023-03-23 19:35

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

徐福沛

项目

(1030)

(0)

收藏


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



图片1.png


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

图片2.png



这时候有两种解决方案

第一种需要在Springboot启动类上添加@ComponentScan(basePackages = {"包名"})


图片3.png


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

图片4.png


0条评论

点击登录参与评论