Druid Srping监控配置

<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource"
init-method="init" destroy-method="close">
<property name="driverClassName" value="${jdbc.driverClassName}" />
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
<property name="maxActive" value="${db.maxActive}" />
<property name="initialSize" value="${db.initialSize}" />
<property name="maxWait" value="${db.maxWait}" />
<property name="minIdle" value="${db.minIdle}" />
<property name="timeBetweenEvictionRunsMillis" value="${db.timeBetweenEvictionRunsMillis}" />
<property name="minEvictableIdleTimeMillis" value="${db.minEvictableIdleTimeMillis}" />
<property name="testWhileIdle" value="${db.testWhileIdle}" />
<property name="testOnBorrow" value="${db.testOnBorrow}" />
<property name="testOnReturn" value="${db.testOnReturn}" />
<property name="poolPreparedStatements" value="${db.poolPreparedStatements}" />
<property name="maxPoolPreparedStatementPerConnectionSize" value="${db.maxPoolPreparedStatementPerConnectionSize}" />
<property name="filters" value="stat" />
</bean>

<!-- 配置druid监控spring jdbc -->
    <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.xxx.*.controller.*</value>
                <value>com.xxx.*.service.*</value>
                <value>com.xxx.*.dao.*</value>
            </list>
        </property>
    </bean>
    <aop:config proxy-target-class="true">
        <aop:advisor advice-ref="druid-stat-interceptor" pointcut-ref="druid-stat-pointcut" />
    </aop:config>

你可能感兴趣的:(spring,bean,druid)