druid连接池监控在spring中的配置(注)
第一步在druid连接池dataSource配置中添加:第二步在web.xml中添加如下代码:DruidStatViewcom.alibaba.druid.support.http.StatViewServletDruidStatView/druid/*DruidWebStatFiltercom.alibaba.druid.suppor
·
第一步在druid连接池dataSource配置中添加(如已存在就不动):
<!-- 配置监控统计拦截的filters,去掉后监控界面sql无法统计 -->
<property name="filters" value="stat" />
第二步在web.xml中添加如下代码:
<servlet>
<servlet-name>DruidStatView</servlet-name>
<servlet-class>com.alibaba.druid.support.http.StatViewServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>DruidStatView</servlet-name>
<url-pattern>/druid/*</url-pattern>
</servlet-mapping>
<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>
</filter>
<filter-mapping>
<filter-name>DruidWebStatFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
第三步重启项目,访问http://ip地址:端口号/项目名/druid/index.html,ok!
更多推荐
已为社区贡献2条内容
所有评论(0)