springboot2.0整合mybatis遇到的坑

之前试过springboot 1.5.6版本整合mybatis,pom依赖如下:



	org.mybatis.spring.boot
	mybatis-spring-boot-starter
	1.0.0



	mysql
	mysql-connector-java



	org.mybatis
	mybatis-spring
	1.2.5

后来springboot升级到2.0.6,依然沿用这个pom依赖,启动一直报错,

Failed to parse mapping resource: 'class path resource [mapper/xml/*.xml]'; nested exception is java.io.FileNotFoundException: class path resource [mapper/xml/*.xml] cannot be opened because it does not exist

原因:


    org.mybatis
    mybatis-spring
    1.2.5

这个依赖的version号太低了,直接删除version即可


    org.mybatis
    mybatis-spring

或者用以下依赖:



	org.mybatis.spring.boot
	mybatis-spring-boot-starter
	1.3.2



	mysql
	mysql-connector-java




	com.alibaba
	druid-spring-boot-starter
	1.1.9

 

你可能感兴趣的:(Springboot,mybatis)