1.pom.xml Configuring MAVEN Dependencies
<Dependency> <groupId>Org.mybatis.spring.boot</groupId> <Artifactid>Mybatis-spring-boot-starter</Artifactid> <version>1.0.0</version> </Dependency>
2. Be sure to add @mapperscan ("Com.xsjt.dao") to the starting place
3. Add configuration to the configuration file
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) #打印SQLmybatis. Typealiasespackage=com.xsjt.beanmybatis.mapperlocations=classpath: Com/xsjt/xml/*mapper.xml
Springboot (10)--Integrated MyBatis