天天看點

Spring Boot 整合 Mybatis (三) druid-spring-boot-starter Druid資料源1.maven依賴2.application.yml配置3.啟動http://127.0.0.1:8081/druid/index.html

https://github.com/alibaba/druid/tree/master/druid-spring-boot-starter

1.maven依賴

<dependency>
   <groupId>com.alibaba</groupId>
   <artifactId>druid-spring-boot-starter</artifactId>
   <version>1.1.10</version>
</dependency>
           

2.application.yml配置

spring:
  application:
    name: mybatis-server
  datasource:
    driverClassName: com.mysql.jdbc.Driver
    url: jdbc:mysql://localhost:3306/flowable_demo?useUnicode=true&characterEncoding=utf-8
    username: root
    password: admin123456
    #druid配置
    druid:
      initial-size: 5
      min-idle: 10
      max-active: 20
      max-wait: 60000
      timeBetweenEvictionRunsMillis: 600000
      minEvictableIdleTimeMillis: 300000
      validationQuery: select 1
      testWhileIdle: true
      testOnBorrow: false
      testOnReturn: false
      poolPreparedStatements: true
      maxOpenPreparedStatements: 20
      async-init: false
      web-stat-filter:
        enabled: true
      stat-view-servlet:
        enabled: true
server:
  port: 8081
           

3.啟動http://127.0.0.1:8081/druid/index.html

Spring Boot 整合 Mybatis (三) druid-spring-boot-starter Druid資料源1.maven依賴2.application.yml配置3.啟動http://127.0.0.1:8081/druid/index.html

繼續閱讀