Mybatis与springboot项目,启动时报错,详细的错误如下:
Field xxx in com.xxxl required a bean of type ‘xxx’ that could not be found.
Action:
Consider defining a bean of type ‘xxx’ in your configuration.
原因是bean装配失败,springboot扫描时没有找到DAO 的@Mapper对应的接口。
解决方法:
在启动类前加上:
@MapperScan(basePackages = { "mapper所在的包路径" })
扫描xx.xx.mapper包下的所有mapper