异常:Consider defining a bean of type ‘com.xxx.xxx.dao.ProductMapper’ in your configuration.
具体异常:
Description: Field productMapper in com.xxx.xxx.service.impl.CommonServiceImpl required a bean of type 'com.xxx.xxx.dao.ProductMapper' that could not be found. Action: Consider defining a bean of type 'com.xxx.xxx.dao.ProductMapper' in your configuration. Disconnected from the target VM, address: '127.0.0.1:61934', transport: 'socket' Process finished with exit code 1原因是没有扫描到dao层的接口
解决方法一 红色框框部分是扫描这个目录下的dao层 解决方法二 单个扫描,把这个dao交个spring管理 @org.apache.ibatis.annotations.Mapper
@Repository @org.apache.ibatis.annotations.Mapper public interface ProductMapper { /** * 查询列表 * @param map * @return */ List<Product> getList(Map<String, Object> map); }