In the use of Springboot 2.0.4 integration MyBatis When the Exception property ' Sqlsessionfactory ' or ' sqlsessiontemplate ' is required, and then a variety of search logs Baidu, A workaround is given on the Web:
Version is too high, using manual injection Sqlsessionfactory, and then with the DAO internship class inheritance, because my project does not have DAO implementation class, directly is the Interface+mapper file, so directly ignored, did not try, want to try to try it
Read the blog dot here (Baidu's handy): This is the portal
@Resource publicvoid setsqlsessionfactory (sqlsessionfactory Sqlsessionfactory) { super.setsqlsessionfactory (sqlsessionfactory); }
Then someone said less mybatis-spring-boot-starter jar package, and then I looked at the Pom.xml file, no less
<Dependency> <groupId>Org.mybatis.spring.boot</groupId> <Artifactid>Mybatis-spring-boot-starter</Artifactid> <version>1.3.2</version> </Dependency>
The pit is here, because I used the pagehelper-spring-boot-starter (this is a page on GitHub tool), and I introduced the version of the conflict, I introduced the 1.3.2 version of the deletion, the project started normally, I hope it can help you
Springboot 2.0.4 Integration MyBatis Unusual property ' sqlsessionfactory ' or ' sqlsessiontemplate ' is required