context.xml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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="propertyCOnfigurer"
  16. class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
  17. <property name="location">
  18. <value>classpath:dbconfig.properties</value>
  19. </property>
  20. </bean>
  21. <bean id="nativeJdbcExtractor"
  22. class="org.springframework.jdbc.support.nativejdbc.CommonsDbcpNativeJdbcExtractor"
  23. lazy-init="true" />
  24. <bean id="oracleLobHandler" class="org.springframework.jdbc.support.lob.OracleLobHandler"
  25. lazy-init="true">
  26. <property name="nativeJdbcExtractor" ref="nativeJdbcExtractor" />
  27. </bean>
  28. <bean id="propertyCfg" class="com.gyee.intial.PropertyCacheContext">
  29. <property name="ignoreResourceNotFound" value="true" />
  30. <property name="locations">
  31. <list>
  32. <value>classpath:webconfig.properties</value>
  33. </list>
  34. </property>
  35. </bean>
  36. <bean id="sequence"
  37. class="org.springframework.jdbc.support.incrementer.OracleSequenceMaxValueIncrementer">
  38. <property name="incrementerName" value="SQ_ID" />
  39. <property name="dataSource" ref="dataSource" />
  40. </bean>
  41. <bean id="dataSource" class="com.jolbox.bonecp.BoneCPDataSource"
  42. destroy-method="close" p:driverClass="${oracle.driverClassName}"
  43. p:jdbcUrl="${oracle.url}" p:username="${oracle.username}" p:password="${oracle.password}"
  44. p:idleConnectionTestPeriodInMinutes="${cpool.idleConnectionTestPeriodInMinutes}"
  45. p:idleMaxAgeInMinutes="${cpool.idleMaxAgeInMinutes}"
  46. p:maxConnectionsPerPartition="${cpool.maxConnectionsPerPartition}"
  47. p:minConnectionsPerPartition="${cpool.minConnectionsPerPartition}"
  48. p:partitionCount="${cpool.partitionCount}" p:acquireIncrement="${cpool.acquireIncrement}"
  49. p:statementsCacheSize="${cpool.statementsCacheSize}"
  50. p:releaseHelperThreads="${cpool.releaseHelperThreads}" />
  51. <aop:config proxy-target-class="true">
  52. <aop:pointcut id="serviceOperation"
  53. expression="execution(* com.gyee.service..*Service.*(..))" />
  54. <aop:advisor pointcut-ref="serviceOperation" advice-ref="txAdvice"
  55. order="1" />
  56. </aop:config>
  57. <bean id="transactionManager"
  58. class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
  59. <property name="dataSource">
  60. <ref bean="dataSource" />
  61. </property>
  62. </bean>
  63. <tx:advice id="txAdvice" transaction-manager="transactionManager">
  64. <tx:attributes>
  65. <tx:method name="get*" read-only="true" rollback-for="Exception" />
  66. <tx:method name="find*" read-only="true" rollback-for="Exception" />
  67. <tx:method name="load*" read-only="true" rollback-for="Exception" />
  68. <tx:method name="unique*" read-only="true" rollback-for="Exception" />
  69. <tx:method name="*" rollback-for="Exception" />
  70. </tx:attributes>
  71. </tx:advice>
  72. <aop:aspectj-autoproxy proxy-target-class="true" />
  73. </beans>