Druid Configuring the Monitoring page and opening the firewall, spring

Source: Internet
Author: User
Tags aop

1. Increase in DataSource

<property name="filters" value="stat,wall"/>

2. Add spring (Spring support)

<!--Druid Spring Monitor setting--><!--open @aspectj AOP Agent--<bean id="Druid-stat-interceptor" class="Com.alibaba.druid.support.spring.stat.DruidStatInterceptor"/> <bean id="Druid-stat-pointcut" class="Org.springframework.aop.support.JdkRegexpMethodPointcut"Scope="prototype"> <property name="Patterns"> <list> <value>com.beta.mss.core.service.*</value> </list&gt        ; </property> </bean> <aop:config proxy-target-class="true"> <aop:advisor advice-ref="Druid-stat-interceptor"pointcut-ref="Druid-stat-pointcut"/> </aop:config>

It is important to note that the patterns in this area is generally only monitored by service,controller, and the spring Proxy uses Cglib proxy mode, but Cglib cannot proxy the final class or the method that is modified by private,final, Cglib Face the specific proxy class, cannot be an interface, the JDK agent is interface-oriented.

3. Web. xml

<!--Druid URL monitor setting start--><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></filter> <filter-mapping><filter-name>druidwebstatfilter</filter-name><url-pattern>/*</ url-pattern></filter-mapping><!--Druid URL Monitor setting end ---
<servlet> <servlet-name>DruidStatView</servlet-name> <servlet-class>com.alibaba.druid.support.http.statviewservlet</servlet-class> <init-param> <!--allow statistics to be emptied-<param-name>resetenable</param-name&              Gt <param-value>true</param-value> </init-param> <!--<init-param>User name<param-name>loginUsername</param-name> <param-value>name</param-value> </ Init-param> <init-param>Password<param-name>loginPassword</param-name> <param-value>pwd</param-value> </i Nit-param>-</servlet> <servlet-mapping> <servlet-name>druidstatview</servlet -name> <url-pattern>/druid/*</url-pattern> </servlet-mapping>

Druid Configuring the Monitoring page and opening the firewall, spring

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.