码迷,mamicode.com
首页 > 编程语言 > 详细

SpringBoot(十)-- 整合MyBatis

时间:2017-11-05 12:22:33      阅读:156      评论:0      收藏:0      [点我收藏+]

标签:host   data   package   pac   XML   initial   mysq   maven依赖   1.0   

1.pom.xml 配置maven依赖

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

2.一定要在启动的地方加上@MapperScan("com.xsjt.dao")

3.配置文件中加上配置

spring.datasource.url=jdbc:mysql://localhost:3306/consult
spring.datasource.username=root
spring.datasource.password=123456
spring.datasource.driver-class-name=org.gjt.mm.mysql.Driver

spring.datasource.max-idle=10
spring.datasource.max-wait=10000
spring.datasource.min-idle=5
spring.datasource.initial-size=5
spring.datasource.validation-query=SELECT 1
spring.datasource.test-on-borrow=false
spring.datasource.test-while-idle=true
spring.datasource.time-between-eviction-runs-millis=18800
spring.datasource.jdbc-interceptors=ConnectionState;SlowQueryReport(threshold=0) #打印SQL

mybatis.typeAliasesPackage=com.xsjt.bean
mybatis.mapperLocations=classpath:com/xsjt/xml/*Mapper.xml

 

SpringBoot(十)-- 整合MyBatis

标签:host   data   package   pac   XML   initial   mysq   maven依赖   1.0   

原文地址:http://www.cnblogs.com/xbq8080/p/7786958.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!