xiongzhu 4 ani în urmă
părinte
comite
9d5dd6766a

+ 6 - 0
pom.xml

@@ -400,6 +400,12 @@
             <artifactId>adapay-java-sdk</artifactId>
             <version>1.2.10</version>
         </dependency>
+
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>druid-spring-boot-starter</artifactId>
+            <version>1.1.21</version>
+        </dependency>
     </dependencies>
 
 </project>

+ 1 - 0
src/main/java/com/izouma/nineth/security/WebSecurityConfig.java

@@ -97,6 +97,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
                 .antMatchers("/activity/all").permitAll()
                 .antMatchers("/activity/get/*").permitAll()
                 .antMatchers("/appVersion/checkIosReview").permitAll()
+                .antMatchers("/druid/**").permitAll()
                 // all other requests need to be authenticated
                 .anyRequest().authenticated().and()
                 // make sure we use stateless session; session won't be used to

+ 48 - 4
src/main/resources/application.yaml

@@ -16,13 +16,57 @@ spring:
     username: raex
     password: K@SdS7e6NTw4CK
     hikari:
-      minimum-idle: 5
-      maximum-pool-size: 30
+      minimum-idle: 20
+      maximum-pool-size: 300
       auto-commit: true
-      idle-timeout: 30000
+      idle-timeout: 7200
       max-lifetime: 1800000
-      connection-timeout: 30000
+      connection-timeout: 5000
       connection-test-query: SELECT 1
+    druid:
+      # 连接池的配置信息
+      # 初始化大小,最小,最大
+      initial-size: 10
+      min-idle: 10
+      maxActive: 300
+      # 配置获取连接等待超时的时间
+      maxWait: 10000
+      # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+      timeBetweenEvictionRunsMillis: 60000
+      # 配置一个连接在池中最小生存的时间,单位是毫秒
+      minEvictableIdleTimeMillis: 300000
+      validationQuery: SELECT 1
+      testWhileIdle: true
+      testOnBorrow: false
+      testOnReturn: false
+      # 打开PSCache,并且指定每个连接上PSCache的大小
+      poolPreparedStatements: true
+      maxPoolPreparedStatementPerConnectionSize: 20
+      # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
+      filters: stat,wall,slf4j
+      # 通过connectProperties属性来打开mergeSql功能;慢SQL记录
+      connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
+      remove-abandoned: true
+      remove-abandoned-timeout: 1800
+      log-abandoned: true
+      # 配置DruidStatFilter
+      web-stat-filter:
+        enabled: true
+        url-pattern: "/*"
+        exclusions: "*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*"
+      # 配置DruidStatViewServlet
+      stat-view-servlet:
+        enabled: true
+        url-pattern: "/druid/*"
+        login-username: admin
+        login-password: 3edc#EDC
+      filter:
+        wall:
+          enabled: true
+          config:
+            condition-and-alway-false-allow: true
+            condition-and-alway-true-allow: true
+            select-where-alway-true-check: false
   jpa:
     database: MySQL
     database_platform: org.hibernate.dialect.MySQL5InnoDBDialect