spring boot 2.0.0 + mybatis 报:Property 'sqlSessionFactory' or 'sqlSessionTemplate' a

Posted 一个逗逼

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了spring boot 2.0.0 + mybatis 报:Property 'sqlSessionFactory' or 'sqlSessionTemplate' a相关的知识,希望对你有一定的参考价值。

spring boot 2.0.0 + mybatis 报:Property ‘sqlSessionFactory‘ or ‘sqlSessionTemplate‘ are required 无法启动

google baidu了一番,多数都提示缺少:

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

其实最重要的应该是缺少如下数据库连接池的包,我这里用的druid,这里要添加druid for spring boot依赖,如下:

<dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid-spring-boot-starter</artifactId>
            <version>1.1.9</version>
</dependency>

添加上后项目启动正常。

以上是关于spring boot 2.0.0 + mybatis 报:Property 'sqlSessionFactory' or 'sqlSessionTemplate' a的主要内容,如果未能解决你的问题,请参考以下文章