##mavenhtml
<dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>1.2.1</version> </dependency>
##application.yml配置java
spring: datasource: url: jdbc:postgresql://localhost:5432/demo driverClassName: org.postgresql.Driver username: postgres password: postgres validation-query: SELECT 1 test-while-idle: true test-on-borrow: true mybatis: config-locations: classpath:mybatis/mybatis-config.xml mapper-locations: classpath:mybatis/mapper/*.xml configuration: map-underscore-to-camel-case: true default-fetch-size: 50 default-statement-timeout: 10 auto-mapping-unknown-column-behavior: WARNING
配置項 mybatis-spring-boot-autoconfigure-1.2.1-sources.jar!/org/mybatis/spring/boot/autoconfigure/MybatisProperties.javaspring
##java配置sql
@MapperScan("com.codecraft.dao") @Configuration public class MybatisConfig { }
##doc數據庫