Java代码 applicationContext.xml _S applicationContext.xml _S_02

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xmlns:aop="http://www.springframework.org/schema/aop"
  5. xmlns:tx="http://www.springframework.org/schema/tx"
  6.  
  7. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
  8. http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
  9. http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
  10. http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
  11.  
  12. <!-- loading jdbc.properties -->
  13. <bean id="configBean" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
  14. <property name="location">
  15. <value>classpath:jdbc.properties</value>
  16. </property>
  17. </bean>
  18.  
  19. <!-- configuration data source -->
  20. <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
  21. <property name="driverClassName" value="${jdbc.driverClassName}"/>
  22. <property name="url" value="${jdbc.url}"/>
  23. <property name="username" value="${jdbc.username}"/>
  24. <property name="password" value="${jdbc.password}"/>
  25. </bean>
  26.  
  27. <bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
  28. <property name="dataSource" ref="dataSource"/>
  29. <property name="configLocation" value="classpath:naming-sql.xml"/>
  30. </bean>
  31.  
  32.  
  33. <tx:advice id="transactionManagerAdivice" transaction-manager="transactionManager">
  34. <tx:attributes>
  35. <tx:method name="*"
  36. isolation="READ_COMMITTED"
  37. propagation="REQUIRED"
  38. rollback-for="java.lang.RuntimeException"/>
  39. </tx:attributes>
  40. </tx:advice>
  41.  
  42. <aop:config proxy-target-class="true">
  43. <aop:pointcut id="allManagerMethod" expression="execution(* org.swj.site.dao.*.*(..))"/>
  44. <aop:advisor advice-ref="transactionManagerAdivice" pointcut-ref="allManagerMethod"/>
  45. </aop:config>
  46.  
  47. <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
  48. <property name="dataSource" ref="dataSource"/>
  49. </bean>
  50.  
  51. </beans>