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

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

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

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

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

posted @ 2023-03-23 19:41  昼夜山  阅读(314)  评论(0编辑  收藏  举报