context2.xml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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" xmlns:aop="http://www.springframework.org/schema/aop"
  4. xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context"
  5. xmlns:tx="http://www.springframework.org/schema/tx"
  6. xsi:schemaLocation="http://www.springframework.org/schema/beans
  7. http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
  8. http://www.springframework.org/schema/context
  9. http://www.springframework.org/schema/context/spring-context-3.0.xsd
  10. http://www.springframework.org/schema/aop
  11. http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
  12. http://www.springframework.org/schema/tx
  13. http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"
  14. default-autowire="byName" default-lazy-init="true">
  15. <bean id="dataSource2" class="com.jolbox.bonecp.BoneCPDataSource"
  16. destroy-method="close">
  17. <property name="driverClass" value="${jdbc2.driverClassName}" />
  18. <property name="jdbcUrl" value="${jdbc2.url}" />
  19. <property name="username" value="${jdbc2.username}" />
  20. <property name="password" value="${jdbc2.password}" />
  21. <property name="idleConnectionTestPeriod" value="${cpool.idleConnectionTestPeriod}" />
  22. <property name="idleMaxAge" value="${cpool.idleMaxAge}" />
  23. <property name="maxConnectionsPerPartition" value="${cpool.maxConnectionsPerPartition}" />
  24. <property name="minConnectionsPerPartition" value="${cpool.minConnectionsPerPartition}" />
  25. <property name="partitionCount" value="${cpool.partitionCount}" />
  26. <property name="acquireIncrement" value="${cpool.acquireIncrement}" />
  27. <property name="statementCacheSize" value="${cpool.statementCacheSize}" />
  28. <property name="releaseHelperThreads" value="${cpool.releaseHelperThreads}" />
  29. <property name="connectionTimeout" value="60000"></property>
  30. </bean>
  31. <aop:config proxy-target-class="true">
  32. <aop:pointcut id="sqlServiceOperation"
  33. expression="execution(* com.gyee*.service..*SqlService.*(..))" />
  34. <aop:pointcut id="sqlJdbcDao"
  35. expression="execution(* com.gyee.dao.SqlGenericJdbcDao.*(..))" />
  36. <aop:advisor pointcut-ref="sqlServiceOperation" advice-ref="txAdvice2"
  37. order="1" />
  38. <aop:advisor pointcut-ref="sqlJdbcDao" advice-ref="txAdvice2"
  39. order="2" />
  40. </aop:config>
  41. <bean id="transactionManager"
  42. class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
  43. <property name="dataSource">
  44. <ref bean="dataSource2" />
  45. </property>
  46. </bean>
  47. <tx:advice id="txAdvice2" transaction-manager="transactionManager">
  48. <tx:attributes>
  49. <tx:method name="get*" read-only="true" rollback-for="Exception" />
  50. <tx:method name="find*" read-only="true" rollback-for="Exception" />
  51. <tx:method name="load*" read-only="true" rollback-for="Exception" />
  52. <tx:method name="unique*" read-only="true" rollback-for="Exception" />
  53. <tx:method name="*" rollback-for="Exception" />
  54. </tx:attributes>
  55. </tx:advice>
  56. <aop:aspectj-autoproxy proxy-target-class="true" />
  57. </beans>