context.xml 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 class="com.hcks.cmfds.core.security.SecurityAuthentication"
  16. init-method="init" lazy-init="false">
  17. <property name="authKey" value=".WEB_AUTH_KEY"></property>
  18. <property name="key" value="windcmfds"></property>
  19. </bean>
  20. <bean id="propertyCOnfigurer"
  21. class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
  22. <property name="location">
  23. <value>classpath:dbconfig.properties</value>
  24. </property>
  25. </bean>
  26. <bean id="propertyCfg" class="com.hcks.cmfds.service.PropertyCacheContext">
  27. <property name="ignoreResourceNotFound" value="true" />
  28. <property name="locations">
  29. <list>
  30. <value>classpath:webconfig.properties</value>
  31. </list>
  32. </property>
  33. </bean>
  34. <bean id="dataSource" class="com.jolbox.bonecp.BoneCPDataSource"
  35. destroy-method="close">
  36. <property name="driverClass" value="${jdbc.driverClassName}" />
  37. <property name="jdbcUrl" value="${jdbc.url}" />
  38. <property name="username" value="${jdbc.username}" />
  39. <property name="password" value="${jdbc.password}" />
  40. <property name="idleConnectionTestPeriod" value="${cpool.idleConnectionTestPeriod}" />
  41. <property name="idleMaxAge" value="${cpool.idleMaxAge}" />
  42. <property name="maxConnectionsPerPartition" value="${cpool.maxConnectionsPerPartition}" />
  43. <property name="minConnectionsPerPartition" value="${cpool.minConnectionsPerPartition}" />
  44. <property name="partitionCount" value="${cpool.partitionCount}" />
  45. <property name="acquireIncrement" value="${cpool.acquireIncrement}" />
  46. <property name="statementCacheSize" value="${cpool.statementCacheSize}" />
  47. <property name="releaseHelperThreads" value="${cpool.releaseHelperThreads}" />
  48. <property name="connectionTimeout" value="600000"></property>
  49. </bean>
  50. <bean id="sequence"
  51. class="org.springframework.jdbc.support.incrementer.OracleSequenceMaxValueIncrementer">
  52. <property name="incrementerName" value="SQ_ID" />
  53. <property name="dataSource" ref="dataSource" />
  54. </bean>
  55. <aop:config proxy-target-class="true">
  56. <aop:pointcut id="serviceOperation"
  57. expression="execution(* com.hcks.cmfds*.service..*Service.*(..))" />
  58. <aop:pointcut id="JdbcDao"
  59. expression="execution(* com.hcks.cmfds.core.persistence.GenericJdbcDao.*(..))" />
  60. <aop:advisor pointcut-ref="serviceOperation" advice-ref="txAdvice"
  61. order="1" />
  62. <aop:advisor pointcut-ref="JdbcDao" advice-ref="txAdvice"
  63. order="2" />
  64. </aop:config>
  65. <bean id="transactionManager"
  66. class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
  67. <property name="dataSource">
  68. <ref bean="dataSource" />
  69. </property>
  70. </bean>
  71. <tx:advice id="txAdvice" transaction-manager="transactionManager">
  72. <tx:attributes>
  73. <tx:method name="get*" read-only="true" rollback-for="Exception" />
  74. <tx:method name="find*" read-only="true" rollback-for="Exception" />
  75. <tx:method name="load*" read-only="true" rollback-for="Exception" />
  76. <tx:method name="unique*" read-only="true" rollback-for="Exception" />
  77. <tx:method name="*" rollback-for="Exception" />
  78. </tx:attributes>
  79. </tx:advice>
  80. <aop:aspectj-autoproxy proxy-target-class="true" />
  81. </beans>