applicationContext.xml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3. xmlns:context="http://www.springframework.org/schema/context"
  4. xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
  5. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  6. xsi:schemaLocation="http://www.springframework.org/schema/beans
  7. http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
  8. http://www.springframework.org/schema/context
  9. http://www.springframework.org/schema/context/spring-context-2.5.xsd
  10. http://www.springframework.org/schema/aop
  11. http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
  12. http://www.springframework.org/schema/tx
  13. http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
  14. <context:annotation-config />
  15. <bean id="popsConfig"
  16. class="com.yw.core.common.MutilPropertyPlaceholderConfigurer">
  17. <property name="locations">
  18. <list>
  19. <value>classpath:jdbc.properties</value>
  20. </list>
  21. </property>
  22. </bean>
  23. <!--
  24. <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
  25. <property name="driverClass" value="${jdbc.driverClassName}"/>
  26. <property name="jdbcUrl" value="${jdbc.url}"/>
  27. <property name="user" value="${jdbc.username}"/>
  28. <property name="password" value="${jdbc.password}"/>
  29. <property name="minPoolSize"><value>10</value></property>
  30. <property name="maxPoolSize"><value>300</value></property>
  31. <property name="maxIdleTime"><value>60</value></property>
  32. <property name="acquireIncrement"><value>2</value></property>
  33. <property name="maxStatements"><value>0</value></property>
  34. <property name="initialPoolSize"><value>20</value></property>
  35. <property name="idleConnectionTestPeriod"><value>60</value></property>
  36. <property name="acquireRetryAttempts"><value>50</value></property>
  37. <property name="testConnectionOnCheckout"><value>false</value></property>
  38. </bean>
  39. -->
  40. <bean id="MsSQLDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
  41. <property name="driverClass" value="${jdbc.msdriverClassName}"/>
  42. <property name="jdbcUrl" value="${jdbc.msurl}"/>
  43. <property name="user" value="${jdbc.msusername}"/>
  44. <property name="password" value="${jdbc.mspassword}"/>
  45. <property name="minPoolSize"><value>1</value></property>
  46. <property name="maxPoolSize"><value>20</value></property>
  47. <property name="maxIdleTime"><value>1800</value></property>
  48. <property name="acquireIncrement"><value>2</value></property>
  49. <property name="maxStatements"><value>0</value></property>
  50. <property name="initialPoolSize"><value>2</value></property>
  51. <property name="idleConnectionTestPeriod"><value>1800</value></property>
  52. <property name="acquireRetryAttempts"><value>30</value></property>
  53. <property name="testConnectionOnCheckout"><value>false</value></property>
  54. </bean>
  55. <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" destroy-method="close">
  56. <property name="url" value="${jdbc.url}" />
  57. <property name="username" value="${jdbc.username}" />
  58. <property name="password" value="${jdbc.password}" />
  59. <property name="filters" value="stat" />
  60. <property name="maxActive" value="20" />
  61. <property name="initialSize" value="1" />
  62. <property name="maxWait" value="60000" />
  63. <property name="minIdle" value="1" />
  64. <property name="timeBetweenEvictionRunsMillis" value="3000" />
  65. <property name="minEvictableIdleTimeMillis" value="300000" />
  66. <property name="validationQuery" value="SELECT 'x'" />
  67. <property name="testWhileIdle" value="true" />
  68. <property name="testOnBorrow" value="false" />
  69. <property name="testOnReturn" value="false" />
  70. <property name="poolPreparedStatements" value="true" />
  71. <property name="maxPoolPreparedStatementPerConnectionSize" value="20" />
  72. </bean>
  73. <!-- 注册一个JDBC数据源事务管理器 -->
  74. <bean id="transactionManager"
  75. class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
  76. <property name="dataSource" ref="dataSource" />
  77. </bean>
  78. <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
  79. <constructor-arg ref="dataSource" />
  80. </bean>
  81. <bean id="jdbcMSSQLSupport" class="com.yw.core.common.JdbcMSSQLSupport">
  82. <constructor-arg ref="MsSQLDataSource" />
  83. </bean>
  84. <bean id="defaultCacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
  85. <property name="configLocation">
  86. <value>classpath:ehcache.xml</value>
  87. </property>
  88. </bean>
  89. <!-- 定义ehCache的工厂,并设置所使用的Cache name -->
  90. <bean id="ehCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
  91. <property name="cacheManager">
  92. <ref local="defaultCacheManager"/>
  93. </property>
  94. <property name="cacheName">
  95. <value>DEFAULT_CACHE</value>
  96. </property>
  97. </bean>
  98. <tx:annotation-driven transaction-manager="transactionManager" />
  99. <bean class="com.yw.core.utils.SpringUtil" />
  100. </beans>