Browse Source

修改连接池配置,加入自动检测间隔时间设置

luoshi 6 years ago
parent
commit
d132dc5f98
1 changed files with 65 additions and 64 deletions
  1. 65 64
      stmms-biz/src/main/resources/service-context.xml

+ 65 - 64
stmms-biz/src/main/resources/service-context.xml

@@ -1,65 +1,66 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
-	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
-	xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jpa="http://www.springframework.org/schema/data/jpa"
-	xmlns:task="http://www.springframework.org/schema/task"
-	xsi:schemaLocation="
-http://www.springframework.org/schema/beans
-http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
-http://www.springframework.org/schema/context
-http://www.springframework.org/schema/context/spring-context-3.2.xsd
-http://www.springframework.org/schema/tx
-http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
-http://www.springframework.org/schema/data/jpa 
-http://www.springframework.org/schema/data/jpa/spring-jpa-1.2.xsd 
-http://www.springframework.org/schema/task 
-http://www.springframework.org/schema/task/spring-task.xsd
-">
-	<!-- 引入属性文件 <context:property-placeholder location="classpath:jdbc.properties" 
-		/> -->
-
-	<!-- 自动扫描dao和service包(自动注入) -->
-	<context:component-scan base-package="cn.com.qmth.stmms.biz" />
-
-	<import resource="spring-jpa.xml" />
-
-	<!-- dbcp数据源 -->
-	<bean name="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
-		destroy-method="close">
-		<property name="driverClassName" value="${driverClassName}" />
-		<property name="url" value="${url}" />
-		<property name="username" value="${username}" />
-		<property name="password" value="${password}" />
-		<property name="maxActive" value="50" />  
-        <property name="initialSize" value="5" />  
-        <property name="maxWait" value="60000" />  
-        <property name="maxIdle" value="5" />  
-        <property name="minIdle" value="5" />
-		<property name="minEvictableIdleTimeMillis" value="1800000" />
-		<property name="testWhileIdle" value="true" />
-		<property name="testOnBorrow" value="false" />
-		<property name="validationQuery" value="SELECT 1" />
-	</bean>
-
-	<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
-		<property name="entityManagerFactory" ref="entityManagerFactory" />
-	</bean>
-
-	<!-- 指定事务声明的配置方式:使用注解的方式 -->
-	<tx:annotation-driven transaction-manager="transactionManager" />
-
-	<bean id="entityManagerFactory"
-		class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
-		<property name="dataSource" ref="dataSource" />
-		<property name="jpaVendorAdapter">
-			<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
-				<property name="database" value="MYSQL" />
-				<property name="showSql" value="false" />
-				<property name="generateDdl" value="true" />
-			</bean>
-		</property>
-	</bean>
-
-	<task:executor id="stmms-executor" pool-size="10" />
-	<task:annotation-driven executor="stmms-executor" />
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
+	xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jpa="http://www.springframework.org/schema/data/jpa"
+	xmlns:task="http://www.springframework.org/schema/task"
+	xsi:schemaLocation="
+http://www.springframework.org/schema/beans
+http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
+http://www.springframework.org/schema/context
+http://www.springframework.org/schema/context/spring-context-3.2.xsd
+http://www.springframework.org/schema/tx
+http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
+http://www.springframework.org/schema/data/jpa 
+http://www.springframework.org/schema/data/jpa/spring-jpa-1.2.xsd 
+http://www.springframework.org/schema/task 
+http://www.springframework.org/schema/task/spring-task.xsd
+">
+	<!-- 引入属性文件 <context:property-placeholder location="classpath:jdbc.properties" 
+		/> -->
+
+	<!-- 自动扫描dao和service包(自动注入) -->
+	<context:component-scan base-package="cn.com.qmth.stmms.biz" />
+
+	<import resource="spring-jpa.xml" />
+
+	<!-- dbcp数据源 -->
+	<bean name="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
+		destroy-method="close">
+		<property name="driverClassName" value="${driverClassName}" />
+		<property name="url" value="${url}" />
+		<property name="username" value="${username}" />
+		<property name="password" value="${password}" />
+		<property name="maxActive" value="50" />  
+        <property name="initialSize" value="5" />  
+        <property name="maxWait" value="60000" />  
+        <property name="maxIdle" value="5" />  
+        <property name="minIdle" value="5" />
+		<property name="minEvictableIdleTimeMillis" value="1800000" />
+		<property name="timeBetweenEvictionRunsMillis" value="60000" />
+		<property name="testWhileIdle" value="true" />
+		<property name="testOnBorrow" value="false" />
+		<property name="validationQuery" value="SELECT 1 FROM DUAL" />
+	</bean>
+
+	<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
+		<property name="entityManagerFactory" ref="entityManagerFactory" />
+	</bean>
+
+	<!-- 指定事务声明的配置方式:使用注解的方式 -->
+	<tx:annotation-driven transaction-manager="transactionManager" />
+
+	<bean id="entityManagerFactory"
+		class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
+		<property name="dataSource" ref="dataSource" />
+		<property name="jpaVendorAdapter">
+			<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
+				<property name="database" value="MYSQL" />
+				<property name="showSql" value="false" />
+				<property name="generateDdl" value="true" />
+			</bean>
+		</property>
+	</bean>
+
+	<task:executor id="stmms-executor" pool-size="10" />
+	<task:annotation-driven executor="stmms-executor" />
 </beans>