Spring mvc 源的Spring拦截器

Spring mvc 源的Spring拦截器,spring-mvc,datasource,eclipselink,interceptor,entitymanager,Spring Mvc,Datasource,Eclipselink,Interceptor,Entitymanager,我使用以下配置连接到我的数据库(一个mysql,一个oracle)。我想知道是否有任何方法可以配置一个spring拦截器来允许我审计对数据库的访问和请求的性能?谢谢你的意见 <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="ignoreUnresolvablePlaceholders" value="true"/>

我使用以下配置连接到我的数据库(一个mysql,一个oracle)。我想知道是否有任何方法可以配置一个spring拦截器来允许我审计对数据库的访问和请求的性能?谢谢你的意见

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="ignoreUnresolvablePlaceholders" value="true"/>
</bean>   
<bean class="org.springframework.web.context.support.ServletContextPropertyPlaceholderConfigurer">
    <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE"/>
    <property name="searchContextAttributes" value="true"/>
    <property name="contextOverride" value="true"/>
    <property name="ignoreResourceNotFound" value="true"/>
    <property name="locations">
        <list>
            <value>classpath:database.properties</value> 
            <value>${config}</value>
        </list>
    </property>
</bean>

<!-- EntityManagerFactory -->
<bean id="userEntityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    <property name="persistenceUnitManager" ref="userPersistenceUnitManager"/> 
    <property name="jpaDialect">
        <bean class="org.springframework.orm.jpa.vendor.EclipseLinkJpaDialect" />
    </property>
    <property name="jpaProperties">
        <props> 
            <prop key="eclipselink.logging.level">FINE</prop>
            <prop key="eclipselink.logging.timestamp">true</prop>
            <prop key="eclipselink.logging.session">true</prop>
            <prop key="eclipselink.logging.thread">true</prop>
            <prop key="eclipselink.logging.exceptions">true</prop>
            <prop key="eclipselink.weaving">false</prop>
        </props>
    </property>
</bean>

<!-- See http://commons.apache.org/dbcp/configuration.html  
-->
<bean id="userDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
    <property name="driverClassName" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
    <property name="url" value="${database.url}"/> 

    <property name="username" value="${database.username}"/> 
    <property name="password" value="${database.password}"/> 

    <!-- performance tuning -->
    <property name="initialSize" value="{database.minConnections}" />
    <property name="maxActive" value="{database.maxConnections}" /> 
    <property name="maxIdle" value="10"/>
    <property name="minIdle" value="1"/>

    <!-- The main purpose for the validation here is to avoid reusing a
         expired DB connection -->
    <property name="validationQuery" value="SELECT 1"/>
    <property name="testOnBorrow" value="true"/>
    <property name="testWhileIdle" value="false"/>
    <property name="testOnReturn" value="false"/>
</bean>

<bean id="userPersistenceUnitManager" class="org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager">
    <property name="persistenceXmlLocations">
        <list>
            <value>classpath:META-INF/user_persistence.xml</value>
        </list>
    </property>
    <property name="defaultDataSource" ref="userDataSource"/>
</bean>

classpath:database.properties
${config}
好的
真的
真的
真的
真的
假的
类路径:META-INF/user_persistence.xml

这在技术上与Spring无关,有几个
数据源
装饰程序可以完成这项工作:

  • 该项目的目标是为JDBC应用程序的SQL查询日志创建一个高性能且易于使用的工具

  • log4jdbc是一个Java JDBC驱动程序,它可以记录其他JDBC驱动程序的SQL和/或JDBC调用(以及可选的SQL定时信息)


谢谢@Tomasz,如果可能的话,真的在寻找拦截器。