Common-conf.xml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
  3. <beans>
  4. <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
  5. <property name="locations">
  6. <list>
  7. <value>/WEB-INF/properties/jdbc.properties</value>
  8. </list>
  9. </property>
  10. </bean>
  11. <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
  12. <property name="driverClassName">
  13. <value>${jdbc.driverClassName}</value>
  14. </property>
  15. <property name="url">
  16. <value>${jdbc.url}</value>
  17. </property>
  18. <property name="username">
  19. <value>${jdbc.username}</value>
  20. </property>
  21. <property name="password">
  22. <value>${jdbc.password}</value>
  23. </property>
  24. <property name="maxActive">
  25. <value>${maxActive}</value>
  26. </property>
  27. <property name="maxWait">
  28. <value>${maxWait}</value>
  29. </property>
  30. <property name="maxIdle">
  31. <value>${maxIdle}</value>
  32. </property>
  33. <property name="initialSize">
  34. <value>${initialSize}</value>
  35. </property>
  36. <!-- 数据库的默认自动提交 -->
  37. <property name="defaultAutoCommit">
  38. <value>true</value>
  39. </property>
  40. <!-- 数据库的连接超时是否启动删除 -->
  41. <property name="removeAbandoned">
  42. <value>true</value>
  43. </property>
  44. <!-- 数据库的删除数据库连接的超时时长 -->
  45. <property name="removeAbandonedTimeout" >
  46. <value>60</value>
  47. </property>
  48. <property name="logAbandoned" >
  49. <value>true</value>
  50. </property>
  51. <property name="validationQuery">
  52. <value>select 1 from dual</value>
  53. </property>
  54. </bean>
  55. <!-- Spring Config -->
  56. <bean id="enums" class="com.base.common.enums.EnumStorage">
  57. <property name="enumFiles">
  58. <list>
  59. <value>/WEB-INF/enums/Common-enums.xml</value>
  60. </list>
  61. </property>
  62. </bean>
  63. <!-- Spring DB Config -->
  64. <bean id="nativeJdbcExtractor" class="org.springframework.jdbc.support.nativejdbc.SimpleNativeJdbcExtractor" />
  65. <bean id="lobHandler" class="org.springframework.jdbc.support.lob.OracleLobHandler" >
  66. <property name="nativeJdbcExtractor">
  67. <ref local="nativeJdbcExtractor"/>
  68. </property>
  69. </bean>
  70. <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
  71. <property name="lobHandler">
  72. <ref local="lobHandler"/>
  73. </property>
  74. <property name="mappingDirectoryLocations">
  75. <list>
  76. <value>/WEB-INF/hbm</value>
  77. </list>
  78. </property>
  79. <property name="dataSource">
  80. <ref local="dataSource"/>
  81. </property>
  82. <property name="hibernateProperties">
  83. <props>
  84. <!-- org.hibernate.dialect.MySQLDialect-->
  85. <prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop>
  86. <prop key="hibernate.show_sql">false</prop>
  87. <prop key="hibernate.cglib.use_reflection_optimizer">false</prop>
  88. <prop key="hibernate.jdbc.batch_size">50</prop>
  89. <prop key="hibernate.order_inserts">true</prop>
  90. <prop key="hibernate.order_updates">true</prop>
  91. <prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
  92. <prop key="hibernate.cache.use_second_level_cache">true</prop>
  93. </props>
  94. </property>
  95. </bean>
  96. <bean id="hibernateTransactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
  97. <property name="sessionFactory">
  98. <ref local="sessionFactory"/>
  99. </property>
  100. </bean>
  101. <bean id="transactionDefinition" class="org.springframework.transaction.support.DefaultTransactionDefinition">
  102. <property name="propagationBehaviorName">
  103. <value>PROPAGATION_REQUIRED</value>
  104. </property>
  105. <property name="isolationLevelName">
  106. <value>ISOLATION_READ_COMMITTED</value>
  107. </property>
  108. </bean>
  109. <bean id="transactionManager" class="com.base.common.spring.SpringTransactionManager">
  110. <property name="transactionManager">
  111. <ref local="hibernateTransactionManager"/>
  112. </property>
  113. <property name="transactionDefinition">
  114. <ref local="transactionDefinition"/>
  115. </property>
  116. </bean>
  117. </beans>