惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Secure Thoughts
罗磊的独立博客
T
The Blog of Author Tim Ferriss
人人都是产品经理
人人都是产品经理
博客园 - 叶小钗
Last Week in AI
Last Week in AI
美团技术团队
Google Online Security Blog
Google Online Security Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
D
Docker
G
Google Developers Blog
大猫的无限游戏
大猫的无限游戏
酷 壳 – CoolShell
酷 壳 – CoolShell
小众软件
小众软件
月光博客
月光博客
L
LINUX DO - 最新话题
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
W
WeLiveSecurity
H
Heimdal Security Blog
Vercel News
Vercel News
SecWiki News
SecWiki News
Forbes - Security
Forbes - Security
Blog — PlanetScale
Blog — PlanetScale
Google DeepMind News
Google DeepMind News
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
www.infosecurity-magazine.com
www.infosecurity-magazine.com
TaoSecurity Blog
TaoSecurity Blog
T
Troy Hunt's Blog
A
About on SuperTechFans
C
Check Point Blog
S
Security Affairs
Hacker News - Newest:
Hacker News - Newest: "LLM"
AI
AI
WordPress大学
WordPress大学
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Help Net Security
Help Net Security
博客园_首页
The Last Watchdog
The Last Watchdog
S
SegmentFault 最新的问题
Hugging Face - Blog
Hugging Face - Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
Engineering at Meta
Engineering at Meta
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
I
Intezer
K
Kaspersky official blog
M
MIT News - Artificial intelligence
J
Java Code Geeks
G
GRAHAM CLULEY
P
Palo Alto Networks Blog

博客园 - _万古如长夜

解析文件内容,匹配请求路径 java log4j 代码中 新增按日保存日志文件的功能 按钮居中固定 博文阅读密码验证 - 博客园 tomcat-设置jdk-设置标题-设置内存-配置项目路径 博文阅读密码验证 - 博客园 博文阅读密码验证 - 博客园 博文阅读密码验证 - 博客园 qrtz表初始化脚本_mysql 工具类 从jar包里复制要打生产的补丁(仅限T2) CPU使用过高问题/死锁 tomcat jvm 内存配置 文件下载-文件后缀 匹配content-type wsdl调用 不生成java文件方式 工具类-老版hibernate 占位符模式(?) in 的问题解决方案 nginx 设置超时 常用的正则表达式 DB2各种命令 mysql 各种命令
WEB项目引入druid监控配置
_万古如长夜 · 2025-09-23 · via 博客园 - _万古如长夜

1、web.xml

<!-- 添加Web应用等监控-->
<filter>
<filter-name>DruidWebStatFilter</filter-name>
<filter-class>com.alibaba.druid.support.http.WebStatFilter</filter-class>
<init-param>
<param-name>exclusions</param-name>
<param-value>*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*</param-value>
</init-param>
<init-param>
<param-name>profileEnable</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>principalCookieName</param-name>
<param-value>USER_COOKIE</param-value>
</init-param>
<init-param>
<param-name>principalSessionName</param-name>
<param-value>USER_SESSION</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>DruidWebStatFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>DruidStatView</servlet-name>
<servlet-class>com.alibaba.druid.support.http.StatViewServlet</servlet-class>
<init-param>
<!-- 允许清空统计数据 -->
<param-name>resetEnable</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<!-- 用户名 -->
<param-name>loginUsername</param-name>
<param-value>druid</param-value>
</init-param>
<init-param>
<!-- 密码 -->
<param-name>loginPassword</param-name>
<param-value>druid</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>DruidStatView</servlet-name>
<url-pattern>/druid/*</url-pattern>
</servlet-mapping>

2、拦截器 SessionFilter

// 以下的文件不进行过滤
        if (uri.startsWith(projectName + "/druid")//支持连接池页面
            )
        {
            arg2.doFilter(arg0, arg1);
        }

3、数据源配置

<?xml version="1.0" encoding="UTF-8"?>
<Context path="/erpfoko" >
    <Resource auth="Container"
              driverClassName="oracle.jdbc.driver.OracleDriver"
              maxActive="50"
              maxIdle="20"
              maxWait="10000"
              name="jdbc/btdb1"
              type="javax.sql.DataSource"
              factory="com.alibaba.druid.pool.DruidDataSourceFactory"
              url="jdbc:oracle:thin:@localhost:1521/orcl"
              username="swyy_0915"
              password="swyy_0915"
              filters="stat"
    />
    <Resource auth="Container"
              driverClassName="oracle.jdbc.driver.OracleDriver"
              maxActive="50"
              maxIdle="20"
              maxWait="10000"
              name="jdbc/btdb2"
              type="javax.sql.DataSource"
              factory="com.alibaba.druid.pool.DruidDataSourceFactory"
              url="jdbc:oracle:thin:@localhost:1521/orcl"
              username="swyy_0915"
              password="swyy_0915"
              filters="stat"
    />
</Context>