Springboot 2.0.4 整合Mybatis出现异常Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required

在使用Springboot 2.0.4 整合Mybatis的时候出现异常Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required,而后各类找日志百度,网上给了一种解决方法:git

版本过高,使用手动注入sqlSessionFactory,而后用dao的实习类继承,由于个人项目没有dao 的实现类,直接是interface+mapper文件,因此直接忽略了,没有试过,想试一下能够试一下github

阅读博客点这里(随手百度的):这里是传送门spring

    @Resource
    public void setSqlSessionFactory(SqlSessionFactory sqlSessionFactory){
        super.setSqlSessionFactory(sqlSessionFactory);
    }

而后有人说少了mybatis-spring-boot-starter jar包,而后我看的pom.xml文件,没有少sql

        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            <version>1.3.2</version>
        </dependency>

坑就出如今这里,由于我用了pagehelper-spring-boot-starter(这是github上一个分页的工具)里面有,和我引入的版本冲突了,把我引入的1.3.2版本的删了,项目就正常启动了,但愿可有帮助大家mybatis

相关文章
相关标签/搜索