druid 开启监控

依赖包

1
2
3
4
5
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.21</version>
</dependency>

在 application.yml 中配置 StatFilter 相关

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
spring:
aop:
proxy-target-class: true
datasource:
url: jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=bkimDB)))
username: test
password: f5AOzZUQ/nGxSSc0iYT0yRlq9+21dzQNHkdv+IKlkIf/I99NZdiAh/3vzUCjRg005FSb0T/LjqwoWuvqzPrv5g==
druid:
initial-size: 1
min-idle: 1
max-active: 3
max-wait: 60000
keep-alive: true
time-between-eviction-runs-millis: 60000
min-evictable-idle-time-millis: 300000
validation-query: SELECT 'x' 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
filter:
wall:
enabled: true
stat:
enabled: true
config:
enabled: true
stat-view-servlet:
enabled: true
connection-properties: config.decrypt=true;config.decrypt.key=MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJqw3NwlMJmXvcUbhlOn7VttbKPegs99ToSlKhlvDf4YD04OaD86/csdIVHgKcaCkYWfY3XIh/vJtUOf/QEwG+0CAwEAAQ==
stat-view-servlet:
enabled: true
url-pattern: /druid/*
jpa:
database: oracle
properties:
hibernate:
dialect: org.hibernate.dialect.Oracle10gDialect

关键配置是

1
2
3
4
5
6
7
8
9
spring:
datasource:
druid:
filter:
stat:
enabled: true
stat-view-servlet:
enabled: true
url-pattern: /druid/*

访问监控页面

http(s)://host:port/project-name/druid/index.html

  • 本文作者: forever杨
  • 本文链接: https://blog.yl-online.top/posts/e95a2fe2.html
  • 版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。如果文章内容对你有用,请记录到你的笔记中。本博客站点随时会停止服务,请不要收藏、转载!