mybatis阿里巴巴德鲁伊数据库的yml配置
时间: 2024-05-11 10:19:28 浏览: 103
以下是 MyBatis、阿里巴巴 Druid 数据库连接池的 YAML 配置示例:
```yaml
mybatis:
mapper-locations: classpath:mapper/*.xml
type-aliases-package: com.example.model
configuration:
map-underscore-to-camel-case: true
cache-enabled: true
lazy-loading-enabled: true
multiple-result-sets-enabled: true
use-column-label: true
default-executor-type: REUSE
default-statement-timeout: 3000
jdbc-type-for-null: NULL
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8&useSSL=false
username: root
password: password
druid:
initial-size: 5
min-idle: 5
max-active: 20
max-wait: 60000
time-between-eviction-runs-millis: 60000
min-evictable-idle-time-millis: 300000
validation-query: select 1 from dual
test-while-idle: true
test-on-borrow: false
test-on-return: false
pool-prepared-statements: true
max-pool-prepared-statement-per-connection-size: 20
filters: stat, wall, log4j
connection-properties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
```
注意:以上是示例配置,需要根据实际情况进行修改。
阅读全文