applicationContext-business.xml 16.2 KB
Newer Older
罗绍泽 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" 
       xmlns:cache="http://www.springframework.org/schema/cache"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
       xmlns:aop="http://www.springframework.org/schema/aop" 
       xmlns:tx="http://www.springframework.org/schema/tx" 
       xmlns:jdbc="http://www.springframework.org/schema/jdbc" 
       xmlns:context="http://www.springframework.org/schema/context" 
       xsi:schemaLocation="http://www.springframework.org/schema/context 
       http://www.springframework.org/schema/context/spring-context-3.0.xsd 
       http://www.springframework.org/schema/beans  
       http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
       http://www.springframework.org/schema/jdbc  
       http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd 
       http://www.springframework.org/schema/tx 
       http://www.springframework.org/schema/tx/spring-tx-3.0.xsd 
       http://www.springframework.org/schema/aop 
       http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
       http://www.springframework.org/schema/cache
       http://www.springframework.org/schema/cache/spring-cache-3.1.xsd">
       
      <!-- 增加数据源dataSource-system -->
      <bean id="dataSource-system"  class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
            <!-- 基本属性 url、user、password -->  
25
			<property name="url" value="jdbc:mysql://192.168.1.116:3306/lcyq_system?useUnicode=true&amp;characterEncoding=utf8&amp;autoReconnect=true&amp;useSSL=false" />  
26 27
			<property name="username" value="lcyq_system" />  
			<property name="password" value="lcyq_system" /> 
罗绍泽 committed
28 29 30 31 32
			<property name="driverClassName" value="com.mysql.jdbc.Driver" /> 
			
			<!-- 配置初始化大小、最小、最大 -->  
			<property name="initialSize" value="1" />  
			<property name="minIdle" value="1" />   
罗绍泽 committed
33
			<property name="maxActive" value="500" />  
罗绍泽 committed
34 35 36 37 38
			
			<!-- 配置获取连接等待超时的时间 -->  
			<property name="maxWait" value="60000" />  
			
			<!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->  
罗绍泽 committed
39
			<property name="timeBetweenEvictionRunsMillis" value="60000" /> 
罗绍泽 committed
40
			
罗绍泽 committed
41 42
			<!-- 超过时间限制是否回收,对于建立时间超过removeAbandonedTimeout的连接强制关闭  -->  
			<property name="removeAbandoned" value="true" />
罗绍泽 committed
43
			
罗绍泽 committed
44 45 46 47 48 49 50 51 52
			<!-- 超过时间限制多长,单位秒 -->  
			<property name="removeAbandonedTimeout" value="60" /> 
			
			<!-- 配置一个连接在池中最小生存的时间,单位是毫秒:1分钟  -->  
			<property name="minEvictableIdleTimeMillis" value="60000" />  
			<!-- 配置一个连接在池中最长生存的时间,单位是毫秒:5分钟 -->  
			<property name="maxEvictableIdleTimeMillis" value="300000" />
			
			<!-- 用来检测连接是否有效的sql,要求是一个查询语句  --> 
罗绍泽 committed
53
			<property name="validationQuery" value="SELECT 'x'" />  
罗绍泽 committed
54 55 56 57 58 59 60 61 62
			<!-- 申请连接的时候检测  --> 
			<property name="testWhileIdle" value="true" /> 
			<!-- 申请连接时执行validationQuery检测连接是否有效,配置为true会降低性能 -->  
			<property name="testOnBorrow" value="false" /> 
			<!-- 归还连接时执行validationQuery检测连接是否有效,配置为true会降低性能 -->  
			<property name="testOnReturn" value="false" />
			
			<!-- 连接池中的minIdle数量以内的连接,空闲时间超过minEvictableIdleTimeMillis,则会执行keepAlive操作 -->  
			<property name="keepAlive" value="true" />   
罗绍泽 committed
63
			
罗绍泽 committed
64 65 66 67
			<!-- 是否缓存preparedStatement,也就是PSCache。PSCache对支持游标的数据库性能提升巨大,比如说oracle。在mysql下建议关闭 -->  
			<property name="poolPreparedStatements" value="false" /> 
			<!-- 要启用PSCache,必须配置大于0,当大于0时,poolPreparedStatements自动触发修改为true --> 
			<property name="maxPoolPreparedStatementPerConnectionSize" value="0" />  
罗绍泽 committed
68 69 70 71 72 73 74 75
			
			<!-- 配置监控统计拦截的filters,去掉后监控界面sql无法统计 -->  
			<property name="filters" value="stat" />
       </bean>
       
        <!-- 增加数据源dataSource-standard -->
      <bean id="dataSource-standard"  class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
          <!-- 基本属性 url、user、password -->  
76
			<property name="url" value="jdbc:mysql://192.168.1.116:3306/jw_standard?useUnicode=true&amp;characterEncoding=utf8&amp;autoReconnect=true&amp;useSSL=false" />  
罗绍泽 committed
77 78 79 80 81 82 83
			<property name="username" value="jw_standard" />  
			<property name="password" value="jw_standard" /> 
			<property name="driverClassName" value="com.mysql.jdbc.Driver" /> 
			
			<!-- 配置初始化大小、最小、最大 -->  
			<property name="initialSize" value="1" />  
			<property name="minIdle" value="1" />   
罗绍泽 committed
84
			<property name="maxActive" value="500" />  
罗绍泽 committed
85 86 87 88 89
			
			<!-- 配置获取连接等待超时的时间 -->  
			<property name="maxWait" value="60000" />  
			
			<!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->  
罗绍泽 committed
90
			<property name="timeBetweenEvictionRunsMillis" value="60000" /> 
罗绍泽 committed
91
			
罗绍泽 committed
92 93
			<!-- 超过时间限制是否回收,对于建立时间超过removeAbandonedTimeout的连接强制关闭  -->  
			<property name="removeAbandoned" value="true" />
罗绍泽 committed
94
			
罗绍泽 committed
95 96 97 98 99 100 101 102 103
			<!-- 超过时间限制多长,单位秒 -->  
			<property name="removeAbandonedTimeout" value="60" /> 
			
			<!-- 配置一个连接在池中最小生存的时间,单位是毫秒:1分钟  -->  
			<property name="minEvictableIdleTimeMillis" value="60000" />  
			<!-- 配置一个连接在池中最长生存的时间,单位是毫秒:5分钟 -->  
			<property name="maxEvictableIdleTimeMillis" value="300000" />
			
			<!-- 用来检测连接是否有效的sql,要求是一个查询语句  --> 
罗绍泽 committed
104
			<property name="validationQuery" value="SELECT 'x'" />  
罗绍泽 committed
105 106 107 108 109 110 111 112 113
			<!-- 申请连接的时候检测  --> 
			<property name="testWhileIdle" value="true" /> 
			<!-- 申请连接时执行validationQuery检测连接是否有效,配置为true会降低性能 -->  
			<property name="testOnBorrow" value="false" /> 
			<!-- 归还连接时执行validationQuery检测连接是否有效,配置为true会降低性能 -->  
			<property name="testOnReturn" value="false" />
			
			<!-- 连接池中的minIdle数量以内的连接,空闲时间超过minEvictableIdleTimeMillis,则会执行keepAlive操作 -->  
			<property name="keepAlive" value="true" />   
罗绍泽 committed
114
			
罗绍泽 committed
115 116 117 118
			<!-- 是否缓存preparedStatement,也就是PSCache。PSCache对支持游标的数据库性能提升巨大,比如说oracle。在mysql下建议关闭 -->  
			<property name="poolPreparedStatements" value="false" /> 
			<!-- 要启用PSCache,必须配置大于0,当大于0时,poolPreparedStatements自动触发修改为true --> 
			<property name="maxPoolPreparedStatementPerConnectionSize" value="0" />  
罗绍泽 committed
119 120 121 122 123 124 125 126
			
			<!-- 配置监控统计拦截的filters,去掉后监控界面sql无法统计 -->  
			<property name="filters" value="stat" />
       </bean>
       
       <!-- 增加数据源dataSource-business -->
       <bean id="dataSource-business"  class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
          <!-- 基本属性 url、user、password -->  
127
			<property name="url" value="jdbc:mysql://192.168.1.116:3306/lcyq_business?useUnicode=true&amp;characterEncoding=utf8&amp;autoReconnect=true&amp;useSSL=false" />  
128 129
			<property name="username" value="lcyq_business" />  
			<property name="password" value="lcyq_business" /> 
罗绍泽 committed
130 131 132 133 134
			<property name="driverClassName" value="com.mysql.jdbc.Driver" /> 
			
			<!-- 配置初始化大小、最小、最大 -->  
			<property name="initialSize" value="1" />  
			<property name="minIdle" value="1" />   
罗绍泽 committed
135
			<property name="maxActive" value="500" />  
罗绍泽 committed
136 137 138 139 140
			
			<!-- 配置获取连接等待超时的时间 -->  
			<property name="maxWait" value="60000" />  
			
			<!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->  
罗绍泽 committed
141
			<property name="timeBetweenEvictionRunsMillis" value="60000" /> 
罗绍泽 committed
142
			
罗绍泽 committed
143 144
			<!-- 超过时间限制是否回收,对于建立时间超过removeAbandonedTimeout的连接强制关闭  -->  
			<property name="removeAbandoned" value="true" />
罗绍泽 committed
145
			
罗绍泽 committed
146 147 148 149 150 151 152 153 154
			<!-- 超过时间限制多长,单位秒 -->  
			<property name="removeAbandonedTimeout" value="60" /> 
			
			<!-- 配置一个连接在池中最小生存的时间,单位是毫秒:1分钟  -->  
			<property name="minEvictableIdleTimeMillis" value="60000" />  
			<!-- 配置一个连接在池中最长生存的时间,单位是毫秒:5分钟 -->  
			<property name="maxEvictableIdleTimeMillis" value="300000" />
			
			<!-- 用来检测连接是否有效的sql,要求是一个查询语句  --> 
罗绍泽 committed
155
			<property name="validationQuery" value="SELECT 'x'" />  
罗绍泽 committed
156 157 158 159 160 161 162 163 164
			<!-- 申请连接的时候检测  --> 
			<property name="testWhileIdle" value="true" /> 
			<!-- 申请连接时执行validationQuery检测连接是否有效,配置为true会降低性能 -->  
			<property name="testOnBorrow" value="false" /> 
			<!-- 归还连接时执行validationQuery检测连接是否有效,配置为true会降低性能 -->  
			<property name="testOnReturn" value="false" />
			
			<!-- 连接池中的minIdle数量以内的连接,空闲时间超过minEvictableIdleTimeMillis,则会执行keepAlive操作 -->  
			<property name="keepAlive" value="true" />   
罗绍泽 committed
165
			
罗绍泽 committed
166 167 168 169
			<!-- 是否缓存preparedStatement,也就是PSCache。PSCache对支持游标的数据库性能提升巨大,比如说oracle。在mysql下建议关闭 -->  
			<property name="poolPreparedStatements" value="false" /> 
			<!-- 要启用PSCache,必须配置大于0,当大于0时,poolPreparedStatements自动触发修改为true --> 
			<property name="maxPoolPreparedStatementPerConnectionSize" value="0" />  
罗绍泽 committed
170 171 172 173 174
			
			<!-- 配置监控统计拦截的filters,去掉后监控界面sql无法统计 -->  
			<property name="filters" value="stat" />
       </bean>
       
175
       <!-- 增加数据源dataSource-activiti -->
罗绍泽 committed
176 177 178 179 180 181 182 183 184 185
       <bean id="dataSource-activiti"  class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
          <!-- 基本属性 url、user、password -->  
			<property name="url" value="jdbc:mysql://192.168.1.116:3306/lcyq_activiti?useUnicode=true&amp;characterEncoding=utf8&amp;autoReconnect=true&amp;useSSL=false" />  
			<property name="username" value="lcyq_activiti" />  
			<property name="password" value="lcyq_activiti" /> 
			<property name="driverClassName" value="com.mysql.jdbc.Driver" /> 
			
			<!-- 配置初始化大小、最小、最大 -->  
			<property name="initialSize" value="1" />  
			<property name="minIdle" value="1" />   
罗绍泽 committed
186
			<property name="maxActive" value="500" />  
罗绍泽 committed
187 188 189 190 191
			
			<!-- 配置获取连接等待超时的时间 -->  
			<property name="maxWait" value="60000" />  
			
			<!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->  
罗绍泽 committed
192
			<property name="timeBetweenEvictionRunsMillis" value="60000" /> 
罗绍泽 committed
193
			
罗绍泽 committed
194 195
			<!-- 超过时间限制是否回收,对于建立时间超过removeAbandonedTimeout的连接强制关闭  -->  
			<property name="removeAbandoned" value="true" />
罗绍泽 committed
196
			
罗绍泽 committed
197 198 199 200 201 202 203
			<!-- 超过时间限制多长,单位秒 -->  
			<property name="removeAbandonedTimeout" value="60" /> 
			
			<!-- 配置一个连接在池中最小生存的时间,单位是毫秒:1分钟  -->  
			<property name="minEvictableIdleTimeMillis" value="60000" />  
			<!-- 配置一个连接在池中最长生存的时间,单位是毫秒:5分钟 -->  
			<property name="maxEvictableIdleTimeMillis" value="300000" />
罗绍泽 committed
204
			
罗绍泽 committed
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220
			<!-- 用来检测连接是否有效的sql,要求是一个查询语句  --> 
			<property name="validationQuery" value="SELECT 'x'" />  
			<!-- 申请连接的时候检测  --> 
			<property name="testWhileIdle" value="true" /> 
			<!-- 申请连接时执行validationQuery检测连接是否有效,配置为true会降低性能 -->  
			<property name="testOnBorrow" value="false" /> 
			<!-- 归还连接时执行validationQuery检测连接是否有效,配置为true会降低性能 -->  
			<property name="testOnReturn" value="false" />
			
			<!-- 连接池中的minIdle数量以内的连接,空闲时间超过minEvictableIdleTimeMillis,则会执行keepAlive操作 -->  
			<property name="keepAlive" value="true" />   
			
			<!-- 是否缓存preparedStatement,也就是PSCache。PSCache对支持游标的数据库性能提升巨大,比如说oracle。在mysql下建议关闭 -->  
			<property name="poolPreparedStatements" value="false" /> 
			<!-- 要启用PSCache,必须配置大于0,当大于0时,poolPreparedStatements自动触发修改为true --> 
			<property name="maxPoolPreparedStatementPerConnectionSize" value="0" />  
罗绍泽 committed
221 222 223 224 225
			
			<!-- 配置监控统计拦截的filters,去掉后监控界面sql无法统计 -->  
			<property name="filters" value="stat" />
       </bean>
       
罗绍泽 committed
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258
      <!-- 增加事务transactionManager-system -->
      <bean id="transactionManager-system" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
           <property name="dataSource" ref="dataSource-system"/>
      </bean>

      <bean id="transactionInterceptor-system" parent="abstractTransactionInterceptor">
		<property name="transactionManager">
			<ref bean="transactionManager-system"/>
		</property>
	  </bean>
	  
	  <!-- 增加事务transactionManager-standard -->
      <bean id="transactionManager-standard" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
           <property name="dataSource" ref="dataSource-standard"/>
      </bean>

      <bean id="transactionInterceptor-standard" parent="abstractTransactionInterceptor">
		<property name="transactionManager">
			<ref bean="transactionManager-standard"/>
		</property>
	  </bean>
	  
	  <!-- 增加事务transactionManager-business -->
	  <bean id="transactionManager-business" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
           <property name="dataSource" ref="dataSource-business"/>
      </bean>
      
      <bean id="transactionInterceptor-business" parent="abstractTransactionInterceptor">
		<property name="transactionManager">
			<ref bean="transactionManager-business"/>
		</property>
	  </bean>
	  
罗绍泽 committed
259 260 261 262 263 264 265 266 267 268 269
	  <!-- 增加事务transactionManager-business -->
	  <bean id="transactionManager-activiti" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
           <property name="dataSource" ref="dataSource-activiti"/>
      </bean>
      
      <bean id="transactionInterceptor-activiti" parent="abstractTransactionInterceptor">
		<property name="transactionManager">
			<ref bean="transactionManager-activiti"/>
		</property>
	  </bean>
	  
罗绍泽 committed
270 271 272 273 274 275 276 277 278 279 280 281
	<!-- 自动创建事务代理 -->
	<bean class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
		<property name="beanNames">
			<list>
				<value>*Business</value>
			</list>
		</property>
		<property name="interceptorNames">
			<list>
				<value>transactionInterceptor-system</value>
				<value>transactionInterceptor-standard</value>
				<value>transactionInterceptor-business</value>
罗绍泽 committed
282
				<value>transactionInterceptor-activiti</value>
罗绍泽 committed
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318
			</list>
		</property>
	</bean>
	
	<bean id="abstractTransactionInterceptor" abstract="true" class="org.springframework.transaction.interceptor.TransactionInterceptor">
		<!-- 配置事务属性 -->
		<property name="transactionAttributes">
			<props>
				<prop key="*">PROPAGATION_REQUIRED</prop>
			</props>
		</property>
	</bean>
	
	
	<bean id="ehcacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager">
        <property name="cacheManager">
            <bean class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
                <property name="configLocation" value="classpath:ehcache.xml"></property>
            </bean>
        </property>
    </bean>
    
    <bean id="cacheManager" class="org.springframework.cache.support.CompositeCacheManager">
       <property name="cacheManagers">
          <list>
            <ref bean="ehcacheManager"/>
          </list>
       </property>
       <property name="fallbackToNoOpCache" value="true"/>
    </bean>
    
    <cache:annotation-driven />
    
    <import resource="business-system.xml"/>
    <import resource="business-standard.xml"/>
    <import resource="business-test.xml"/>
319
    <import resource="business-process.xml"/>
罗绍泽 committed
320
    <import resource="business-activiti.xml"/>
罗绍泽 committed
321
</beans>