这个问题的解决:先看问题
***************************
APPLICATION FAILED TO START
***************************
Description:
A component required a bean of type 'com.gao.spting_test.dao.GoodsTypeDao' that could not be found.
Action:
Consider defining a bean of type 'com.gao.spting_test.dao.GoodsTypeDao' in your configuration.
Disconnected from the target VM, address: '127.0.0.1:1862', transport: 'socket'
关键在标红的部分:dao文件找不到
解决方案:
1.先看SptingTestApplication
运行主入口的class文件里查看注解是否正确,画圈的地方明显有错误,@MapperScan注解下的basePackages={"com.gao.spring_test.dao"},因为查的是包级,所以到dao就应该结束,复制路径过来的就会带上xml文件,就会造成上面的错误。

2.看dao层里面的mapper文件
看是否加了@Mapper注解,交给Spring管理

3.看application.yml文件中的mapperPath路径是否正确!


4644

被折叠的 条评论
为什么被折叠?



