1.pom.xml 配置maven依赖
org.mybatis.spring.boot mybatis-spring-boot-starter 1.3.1
2.一定要在启动的地方加上@MapperScan("com.xsjt.dao")
3.配置文件中加上配置
spring.datasource.url=jdbc:mysql://localhost:3306/consultspring.datasource.username=rootspring.datasource.password=123456spring.datasource.driver-class-name=org.gjt.mm.mysql.Driverspring.datasource.max-idle=10spring.datasource.max-wait=10000spring.datasource.min-idle=5spring.datasource.initial-size=5spring.datasource.validation-query=SELECT 1spring.datasource.test-on-borrow=falsespring.datasource.test-while-idle=truespring.datasource.time-between-eviction-runs-millis=18800spring.datasource.jdbc-interceptors=ConnectionState;SlowQueryReport(threshold=0)mybatis.typeAliasesPackage=com.xsjt.beanmybatis.mapperLocations=classpath:com/xsjt/xml/*Mapper.xml
4.源码下载