context.xml 3.5 KB

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