報錯如下:
Description:
Field tbItemMapper in com.e3mall.cms.service.cmsServiceImpl required a bean of type
'com.e3mall.cms.dao.mapper.TbItemMapper' that could not be found.
Action:
Consider defining a bean of type 'com.e3mall.cms.dao.mapper.TbItemMapper' in your configuration.
環境:
mapper接口上已經添加了@Component,且pom.xml中不會過濾調xml文件。
原因:
springboot默認不會掃描到對應的bean文件
解決:
方式1、在mapper接口上添加@Mapper
方式2、在application啟動類上添加@MapperScan(basePackages = {"com.e3mall.cms.dao.mapper"})