最近同事在合代码的时候出现了这个报错:
错误提示:
// 看字面意思很简单:提示找不到包,加了各种注解也无济于事,比如:@Repository、@ComponentScan等
Field shuShuDao in com.xxx.data.service.impl.xxxxImpl required a bean of type 'com.xx.xx.xx.xx.xxx.daoName' that could not be found.
The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)
Action:
Consider defining a bean of type 'com.xx.xx.xx.xx.xxx.daoName' in your configuration.
Process finished with exit code 1
具体过程就是我的代码在原项目可以正常运行,他将我的代码照搬过来后却一直报这个错,我确认了导包的位置无误,注解无误,后来觉得好像是启动时的包扫描范围有误,范围太小,所需导包在扫描范围之外,导致未找到包,经查验证后确实是这样的
上原代码截图:
可以看到项目启动时扫描的db包范围限制gmssdk包下!