diff --git a/genshin-map-api/genshin-map-api-core/genshin-map-api-core-core/src/main/java/site/yuanshen/genshin/core/auth/WebSecurityConfiguration.java b/genshin-map-api/genshin-map-api-core/genshin-map-api-core-core/src/main/java/site/yuanshen/genshin/core/auth/WebSecurityConfiguration.java index 1175eb3a..16583776 100644 --- a/genshin-map-api/genshin-map-api-core/genshin-map-api-core-core/src/main/java/site/yuanshen/genshin/core/auth/WebSecurityConfiguration.java +++ b/genshin-map-api/genshin-map-api-core/genshin-map-api-core-core/src/main/java/site/yuanshen/genshin/core/auth/WebSecurityConfiguration.java @@ -44,7 +44,8 @@ protected void configure(HttpSecurity http) throws Exception { "/api/**", "/system/**", "/v3/**", - "/swagger-ui/**" + "/swagger-ui/**", + "/druid/**" ).permitAll() .anyRequest().authenticated() .and() diff --git a/genshin-map-config/src/main/resources-dev/application-dev.yml b/genshin-map-config/src/main/resources-dev/application-dev.yml index 674691c7..9ab17dd7 100644 --- a/genshin-map-config/src/main/resources-dev/application-dev.yml +++ b/genshin-map-config/src/main/resources-dev/application-dev.yml @@ -1,19 +1,33 @@ spring: profiles: include: + - common - nacos-dev - datasource-dev datasource: - driver-class-name: com.mysql.cj.jdbc.Driver - type: com.alibaba.druid.pool.DruidDataSource + datasource: + druid: + # 初始连接数 + initial-size: 8 + #最大连接数 + max-active: 20 + # 最小保持连接数 + min-idle: 8 + async-init: false + ########## 配置StatViewServlet(监控页面),用于展示Druid的统计信息 ########## + stat-view-servlet: + login-username: root # 配置监控页面访问密码 + login-password: 123 + reset-enable: false # 不允许清空统计数据,重新计算 logging: level: site: - yuanshen: - genshin: + @@ -21,4 +28,8 @@ logging: core: debug - site.yuanshen.data.mapper: debug -# org.springframework: + data: + mapper: debug + org: + springframework: # security: debug -# cache: debug + cache: debug \ No newline at end of file diff --git a/genshin-map-config/src/main/resources-prod/application-prod.yml b/genshin-map-config/src/main/resources-prod/application-prod.yml index 98a6b15d..ba354863 100644 --- a/genshin-map-config/src/main/resources-prod/application-prod.yml +++ b/genshin-map-config/src/main/resources-prod/application-prod.yml @@ -1,29 +1,21 @@ spring: profiles: include: + - common - nacos-prod - datasource-prod datasource: - driver-class-name: com.mysql.cj.jdbc.Driver - type: com.alibaba.druid.pool.DruidDataSource - datasource: - druid: - time-between-eviction-runs-millis: 10000 - min-evictable-idle-time-millis: 30000 - max-evictable-idle-time-millis: 7200000 - validation-query-timeout: 3 - validation-query: SELECT 1 - test-on-borrow: false - test-on-return: false - test-while-idle: true - max-active: 20 - max-pool-prepared-statement-per-connection-size: 20 - initial-size: 2 - max-wait: 6000 - min-idle: 2 - pool-prepared-statements: true - max-open-prepared-statements: 20 - async-init: true + druid: + # 初始连接数 + initial-size: 50 + #最大连接数 + max-active: 100 + # 最小保持连接数 + min-idle: 50 + ########## 配置StatViewServlet(监控页面),用于展示Druid的统计信息 ########## + stat-view-servlet: + enabled: true # 启用StatViewServlet + reset-enable: false # 清空统计数据 springdoc: api-docs: diff --git a/genshin-map-config/src/main/resources/application-common.yml b/genshin-map-config/src/main/resources/application-common.yml new file mode 100644 index 00000000..ccd9cc46 --- /dev/null +++ b/genshin-map-config/src/main/resources/application-common.yml @@ -0,0 +1,41 @@ +spring: + datasource: + driver-class-name: org.postgresql.Driver + type: com.alibaba.druid.pool.DruidDataSource + druid: + # 池中某个连接的空闲时长达到 N 毫秒后, 连接池在下次检查空闲连接时,将回收该连接 + min-evictable-idle-time-millis: 300000 + # 检测超时 + validation-query-timeout: 1 + validation-query: SELECT 1 + # 申请连接时检测有效,影响性能 + test-on-borrow: false + # 归还连接时检测有效,影响性能 + test-on-return: false + # 循环检测有效,不影响性能 + test-while-idle: true + # 检查空闲连接的频率,单位毫秒 + time-between-eviction-runs-millis: 10000 + # 是否缓存preparedStatement, mysql下关闭,支持游标的数据库开启 + pool-prepared-statements: true + # 缓存preparedStatement大小,开启后建议100,-1关闭 + max-pool-prepared-statement-per-connection-size: 100 + async-init: false + filter: + # 开启druiddatasource的状态监控 + stat: + enabled: true + db-type: postgresql + log-slow-sql: true + slow-sql-millis: 1000 + connection-stack-trace-enable: true + ########## 配置WebStatFilter,用于采集web关联监控的数据 ########## + web-stat-filter: + enabled: true # 启动 StatFilter + url-pattern: /* # 过滤所有url + exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*" # 排除一些不必要的url + session-stat-enable: false # 开启session统计功能 + ########## 配置StatViewServlet(监控页面),用于展示Druid的统计信息 ########## + stat-view-servlet: + enabled: true # 启用StatViewServlet + reset-enable: true # 不允许清空统计数据,重新计算 \ No newline at end of file diff --git a/genshin-map-config/src/main/resources/application.yml b/genshin-map-config/src/main/resources/application.yml deleted file mode 100644 index e69de29b..00000000