[Mysql] SpringBoot_2.1.0 + Druid_1.1.10 configuration data source monitoring service Yml format

Access address: localhost: 8080 / druid

According to this method configuration and version no problem

High or low version may appear incompatible

1, adding a dependency

<dependency>
     <groupId>com.alibaba</groupId>
     <artifactId>druid-spring-boot-starter</artifactId>
     <version>1.1.10</version>
</dependency>
 <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.0.RELEASE</version>
 </parent>

2, 配置 YML

Spring: 
  DataSource: 
    URL: 
    username: the root 
    password: 
    type: com.alibaba.druid.pool.DruidDataSource 
    Druid: 
      # The following connection pool is added, is applied to all of the above data sources 
      # initial size, minimum, maximum 
      initial-size :. 5 
      min-iDLE:. 5 
      max-Active: 20 is 
      # configuration obtaining connection waiting timeout 
      max the wait-: 60000 
      # intervals the frequency of such detection, an idle connection is detected to be closed, in milliseconds 
      time-between-eviction- -of millis the runs: 60000 
      # configure a minimum connection time survival pool milliseconds 
      min-evictable-IDLE-time-of millis: 300000 
      Validation Query-: the SELECT the DUAL the FROM. 1 
      Test-the while-IDLE: to true 
      Test-ON- borrow: false 
      the Test-ON-return: false
      # Open PSCache, and specifies the size of each connection PSCache 
      the pool--Prepared statements: to true 
      # configure the monitoring statistics intercepted filters, after removing the monitoring interface can not sql statistics, 'wall' Firewalls 
      max-pool-prepared-statement- Connection-size-per: 20 is 
      Filters: STAT, Wall 
      use-Global-Data-Source-STAT: to true 
      # mergeSql opened by connectProperties function attributes; slow SQL record 
      connect-properties: druid.stat.mergeSql = true; druid.stat 5000 = .slowSqlMillis 
      # configure monitoring server 
      STAT-View-the servlet: 
        the Login-username: ADMIN 
        the Login-password: 123456 
        the RESET-enable: false 
        url-pattern: / Druid / * 
        # Add IP whitelist 
        #allow: 
      WEB- stat-filter: 
        # Add IP blacklist when the whitelist and blacklist repeat, a higher priority blacklist
        #deny:
        # Add filtering rules 
        url-pattern: / * 
        # ignore filter format 
        exclusions: "* .js, * gif , * jpg, * png, * css, * ico, / druid / *....."

Guess you like

Origin www.cnblogs.com/itworkers/p/12622308.html