|
|
@@ -104,6 +104,43 @@ public class SpringBootDemoOrmMybatisApplication { |
|
|
|
} |
|
|
|
``` |
|
|
|
|
|
|
|
## application.yml |
|
|
|
|
|
|
|
```yaml |
|
|
|
spring: |
|
|
|
datasource: |
|
|
|
url: jdbc:mysql://127.0.0.1:3306/spring-boot-demo?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&failOverReadOnly=false&serverTimezone=GMT%2B8 |
|
|
|
username: root |
|
|
|
password: root |
|
|
|
driver-class-name: com.mysql.cj.jdbc.Driver |
|
|
|
type: com.zaxxer.hikari.HikariDataSource |
|
|
|
initialization-mode: always |
|
|
|
continue-on-error: true |
|
|
|
schema: |
|
|
|
- "classpath:db/schema.sql" |
|
|
|
data: |
|
|
|
- "classpath:db/data.sql" |
|
|
|
hikari: |
|
|
|
minimum-idle: 5 |
|
|
|
connection-test-query: SELECT 1 FROM DUAL |
|
|
|
maximum-pool-size: 20 |
|
|
|
auto-commit: true |
|
|
|
idle-timeout: 30000 |
|
|
|
pool-name: SpringBootDemoHikariCP |
|
|
|
max-lifetime: 60000 |
|
|
|
connection-timeout: 30000 |
|
|
|
logging: |
|
|
|
level: |
|
|
|
com.xkcoding: debug |
|
|
|
com.xkcoding.orm.mybatis.mapper: trace |
|
|
|
mybatis: |
|
|
|
configuration: |
|
|
|
# 下划线转驼峰 |
|
|
|
map-underscore-to-camel-case: true |
|
|
|
mapper-locations: classpath:mappers/*.xml |
|
|
|
type-aliases-package: com.xkcoding.orm.mybatis.entity |
|
|
|
``` |
|
|
|
|
|
|
|
## UserMapper.java |
|
|
|
|
|
|
|
```java |
|
|
|