SpringBoot2整合Mybatis问题小计

1.org.apache.ibatis.session.Configuration.setVfsImpl
网上都说是需要导入@Mapper和@Component,我测试了没用,是因为导入了compile('org.apache.ibatis:ibatis-core:3.0'),这里的Configuration对象是没有这个方法的,所以报错了。

2.@Mapper@MapperScan二者只需选一个即可。

3.关于xml导入问题,原先是放在com.xx.xx.mapper下,配置文件配置如:mapper-locations: classpath:com/xx/xx/mapper/*.xml,结果就是不行,把它换到resources目录下,在resources目录下创建mapper目录,配置文件改为 mapper-locations: classpath:mapper/*.xml即可。

你可能感兴趣的:(SpringBoot2整合Mybatis问题小计)