applicationContext-business.xml 11.8 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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
			<property name="driverClassName" value="com.mysql.jdbc.Driver" /> 
			
			<!-- 配置初始化大小、最小、最大 -->  
			<property name="initialSize" value="1" />  
			<property name="minIdle" value="1" />   
			<property name="maxActive" value="20" />  
			
			<!-- 配置获取连接等待超时的时间 -->  
			<property name="maxWait" value="60000" />  
			
			<!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->  
			<property name="timeBetweenEvictionRunsMillis" value="60000" />  
			
			<!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->  
			<property name="minEvictableIdleTimeMillis" value="300000" />  
			
			<property name="validationQuery" value="SELECT 'x'" />  
			<property name="testWhileIdle" value="true" />  
			<property name="testOnBorrow" value="false" />  
			<property name="testOnReturn" value="false" />  
			
			<!-- 打开PSCache,并且指定每个连接上PSCache的大小 -->  
			<property name="poolPreparedStatements" value="true" />  
			<property name="maxPoolPreparedStatementPerConnectionSize" value="20" />  
			
			<!-- 配置监控统计拦截的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 -->  
60
			<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
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
			<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" />   
			<property name="maxActive" value="20" />  
			
			<!-- 配置获取连接等待超时的时间 -->  
			<property name="maxWait" value="60000" />  
			
			<!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->  
			<property name="timeBetweenEvictionRunsMillis" value="60000" />  
			
			<!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->  
			<property name="minEvictableIdleTimeMillis" value="300000" />  
			
			<property name="validationQuery" value="SELECT 'x'" />  
			<property name="testWhileIdle" value="true" />  
			<property name="testOnBorrow" value="false" />  
			<property name="testOnReturn" value="false" />  
			
			<!-- 打开PSCache,并且指定每个连接上PSCache的大小 -->  
			<property name="poolPreparedStatements" value="true" />  
			<property name="maxPoolPreparedStatementPerConnectionSize" value="20" />  
			
			<!-- 配置监控统计拦截的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 -->  
95
			<property name="url" value="jdbc:mysql://192.168.1.116:3306/lcyq_business?useUnicode=true&amp;characterEncoding=utf8&amp;autoReconnect=true&amp;useSSL=false" />  
96 97
			<property name="username" value="lcyq_business" />  
			<property name="password" value="lcyq_business" /> 
罗绍泽 committed
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
			<property name="driverClassName" value="com.mysql.jdbc.Driver" /> 
			
			<!-- 配置初始化大小、最小、最大 -->  
			<property name="initialSize" value="1" />  
			<property name="minIdle" value="1" />   
			<property name="maxActive" value="20" />  
			
			<!-- 配置获取连接等待超时的时间 -->  
			<property name="maxWait" value="60000" />  
			
			<!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->  
			<property name="timeBetweenEvictionRunsMillis" value="60000" />  
			
			<!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->  
			<property name="minEvictableIdleTimeMillis" value="300000" />  
			
			<property name="validationQuery" value="SELECT 'x'" />  
			<property name="testWhileIdle" value="true" />  
			<property name="testOnBorrow" value="false" />  
			<property name="testOnReturn" value="false" />  
			
			<!-- 打开PSCache,并且指定每个连接上PSCache的大小 -->  
			<property name="poolPreparedStatements" value="true" />  
			<property name="maxPoolPreparedStatementPerConnectionSize" value="20" />  
			
			<!-- 配置监控统计拦截的filters,去掉后监控界面sql无法统计 -->  
			<property name="filters" value="stat" />
       </bean>
       
罗绍泽 committed
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
       <!-- 增加数据源dataSource-business -->
       <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" />   
			<property name="maxActive" value="20" />  
			
			<!-- 配置获取连接等待超时的时间 -->  
			<property name="maxWait" value="60000" />  
			
			<!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->  
			<property name="timeBetweenEvictionRunsMillis" value="60000" />  
			
			<!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->  
			<property name="minEvictableIdleTimeMillis" value="300000" />  
			
			<property name="validationQuery" value="SELECT 'x'" />  
			<property name="testWhileIdle" value="true" />  
			<property name="testOnBorrow" value="false" />  
			<property name="testOnReturn" value="false" />  
			
			<!-- 打开PSCache,并且指定每个连接上PSCache的大小 -->  
			<property name="poolPreparedStatements" value="true" />  
			<property name="maxPoolPreparedStatementPerConnectionSize" value="20" />  
			
			<!-- 配置监控统计拦截的filters,去掉后监控界面sql无法统计 -->  
			<property name="filters" value="stat" />
       </bean>
       
罗绍泽 committed
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
      <!-- 增加事务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
195 196 197 198 199 200 201 202 203 204 205
	  <!-- 增加事务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
206 207 208 209 210 211 212 213 214 215 216 217
	<!-- 自动创建事务代理 -->
	<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
218
				<value>transactionInterceptor-activiti</value>
罗绍泽 committed
219 220 221 222 223 224 225 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
			</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"/>
255
    <import resource="business-process.xml"/>
罗绍泽 committed
256
    <import resource="business-activiti.xml"/>
罗绍泽 committed
257
</beans>