spring application.xml

<beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:context="http://www.springframework.org/schema/context"
 xmlns:aop="http://www.springframework.org/schema/aop"
 xmlns:tx="http://www.springframework.org/schema/tx"
 xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd      
     http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd     
     http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd     
     http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"
 default-lazy-init="true">

 <!--系统管理配置文件 结束 -->
 <bean
  class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
  <property name="systemPropertiesModeName"
   value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
  <property name="ignoreResourceNotFound" value="true" />
  <property name="locations">
   <list>
    <value>classpath:webpoint-config.properties</value>
   </list>
  </property>
 </bean>
 <bean id="dataSource"
  class="org.springframework.jndi.JndiObjectFactoryBean">
  <property name="jndiName">
   <!--
   <value>java:comp/env/jdbc/iap</value>
   <value>jdbc/iap</value>
    -->
   <value>java:comp/env/jdbc/iap</value>
  </property>
 </bean>
 
 <!--
 <bean id="sessionFactory"
  class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
  <property name="dataSource" ref="dataSource" />
  <property name="namingStrategy">
   <bean class="org.hibernate.cfg.ImprovedNamingStrategy" />
  </property>
  <property name="hibernateProperties">
   <props>
    <prop key="hibernate.dialect">
     ${spring.hibernate.dialect}
    </prop>
    <prop key="hibernate.show_sql">
     ${spring.hibernate.show_sql}
    </prop>
    <prop key="hibernate.cache.provider_class">
     ${spring.hibernate.cache.provide_class}
    </prop>
    <prop
     key="hibernate.cache.provider_configuration_file_resource_path">
     ${spring.hibernate.cache.provider_file_path}
    </prop>
   </props>
  </property>
  <property name="packagesToScan"
   value="${spring.hibernate.annotated_packages}" />
 </bean>   -->

 <bean id="sqlMapClient"
  class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
  <property name="configLocation">
   <value>classpath:sql-map-config.xml</value>
  </property>
  <property name="dataSource" ref="dataSource" />
 </bean>
 <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
 <context:component-scan base-package="com.tydic" />
 <context:annotation-config />
 <aop:aspectj-autoproxy />

 <!-- 性能分析 @Profiled(tag = "dynamicTag_{$0}") -->
 <bean id="timingAspect" class="org.perf4j.log4j.aop.TimingAspect" />

 <bean id="transactionManager"
  class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
  <property name="dataSource" ref="dataSource" />
 </bean>
 <tx:annotation-driven transaction-manager="transactionManager"
  proxy-target-class="true" />

 <bean id="defaultCacheManager"
  class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
  <property name="configLocation">
   <value>${spring.ehcache.class_file_path}</value>
  </property>
 </bean>

 <bean id="authorityCache"
  class="org.springframework.cache.ehcache.EhCacheFactoryBean">
  <property name="cacheManager" ref="defaultCacheManager" />
  <property name="cacheName">
   <value>authorityCache</value>
  </property>
 </bean>

 <bean id="userServiceCache"
  class="org.springframework.cache.ehcache.EhCacheFactoryBean">
  <property name="cacheManager" ref="defaultCacheManager" />
  <property name="cacheName">
   <value>userServiceCache</value>
  </property>
 </bean>
 
 <bean id="ehcacheInterceptor"
  class="com.tydic.webpoint.core.cache.ehcache.EhcacheInterceptor">
  <property name="caches">
   <map>
    <!-- 可以配置多个cache类型 -->
    <entry key="defaultCache">
     <ref local="authorityCache" />
    </entry>
    <entry key="userServiceCache">
     <ref local="userServiceCache" />
    </entry>
   </map>
  </property>
 </bean>

 <bean
  class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
  <property name="beanNames">
   <list>
    <value>*Service</value>
   </list>
  </property>
  <property name="interceptorNames">
   <list>
    <!--
    <value>logInterceptor</value>
     -->
    <value>perf4jInterceptor</value>
    <value>ehcacheInterceptor</value>
   </list>
  </property>
 </bean>

 
 <bean
  class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
  <property name="beanNames">
   <list>
    <value>*Detail</value>
   </list>
  </property>
  <property name="interceptorNames">
   <list>
    <value>ehcacheInterceptor</value>
   </list>
  </property>
 </bean>

 <import resource="classpath:applicationContext-sys.xml" />
 <import resource="classpath:applicationContext-iap.xml" />
 <!--
 <import resource="classpath:applicationContext-cxf.xml" />
 <import resource="classpath:spring.quartz.xml" />
  -->
 
 <aop:config>
  <aop:pointcut id="templateServiceMethods"
   expression="execution(* com.tydic.webpoint.core.service..*.*(..))" />
  <aop:advisor advice-ref="txAdvice"
   pointcut-ref="templateServiceMethods" />
 </aop:config>

 <tx:advice id="txAdvice" transaction-manager="transactionManager">
  <tx:attributes>
   <tx:method name="*" read-only="true" />
   <tx:method name="batch*" propagation="REQUIRED" />
   <tx:method name="add*" propagation="REQUIRED" />
   <tx:method name="save*" propagation="REQUIRED" />
   <tx:method name="insert*" propagation="REQUIRED" />
   <tx:method name="update*" propagation="REQUIRED" />
   <tx:method name="edit*" propagation="REQUIRED" />
   <tx:method name="delete*" propagation="REQUIRED" />
   <tx:method name="remove*" propagation="REQUIRED" />
   <tx:method name="do*" propagation="REQUIRED" />
   <tx:method name="on*" propagation="REQUIRED" />
  </tx:attributes>
 </tx:advice>
</beans>

你可能感兴趣的:(application)