Files
SIPAIIS_WMS_JSSW/bin/WebRoot/WEB-INF/spring-mybatis-scada.xml
2026-01-16 14:13:44 +08:00

122 lines
5.8 KiB
XML
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.1.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.1.xsd">
<bean id="dataSourceScada" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="${driver}" />
<property name="url" value="${scada-url}" />
<property name="username" value="${scada-username}" />
<property name="password" value="${scada-password}" />
<!-- 初始化连接大小 -->
<property name="initialSize" value="5"></property>
<!-- 连接池最大连接数-->
<property name="maxActive" value="15"></property>
<!-- 连接池最大空闲数 -->
<property name="maxIdle" value="10"></property>
<!-- 连接池最小空闲数 -->
<property name="minIdle" value="5"></property>
<!-- 获取连接最大等待时间,以毫秒为单位. -->
<property name="maxWait" value="30000"></property>
<!-- 设置在自动回收超时连接的时候打印连接的超时错误  -->
<property name="logAbandoned" value="true"/>
<!-- 设置自动回收超时连接 -->
<property name="removeAbandoned" value="true"/>
<!-- 自动回收超时时间(以秒数为单位) -->
<property name="removeAbandonedTimeout" value="180"/>
<!-- 连接在池中保持空闲而不被空闲连接回收器线程,以毫秒为单位.-->
<property name="minEvictableIdleTimeMillis" value="1800000" />
<!-- 在空闲连接回收器线程运行期间休眠的时间值,以毫秒为单位. -->
<property name="timeBetweenEvictionRunsMillis" value="600000" />
<!-- 在每次空闲连接回收器线程(如果有)运行时检查的连接数量 -->
<property name="numTestsPerEvictionRun" value="10"/>
<!-- SQL查询,用来验证从连接池取出的连接,在将连接返回给调用者之前.如果指定,则查询必须是一个SQL SELECT并且必须返回至少一行记录 -->
<!-- <property name="validationQuery">
<value>SELECT 1</value>
</property> -->
<!-- 指明是否在从池中取出连接前进行检验,如果检验失败,则从池中去除连接并尝试取出另一个. -->
<!-- <property name="testOnBorrow">
<value>true</value>
</property> -->
</bean>
<!-- spring和MyBatis整合 -->
<bean id="sqlSessionFactoryScada" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSourceScada" />
<!-- <property name="configLocation" value="/WEB-INF/mybatis-config.xml"></property> -->
<!-- 自动扫描mapping.xml文件 -->
<property name="mapperLocations">
<array>
<value>classpath*:com/sipai/mapper/scada/**/*.xml</value>
</array>
</property>
<!-- 翻页功能 -->
<property name="plugins">
<array>
<bean class="com.github.pagehelper.PageHelper">
<property name="properties">
<value>
dialect=sqlserver
reasonable=true
</value>
</property>
</bean>
</array>
</property>
</bean>
<!-- 获取sqlSession, 用于commDao的实现-->
<bean id="sqlSessionScada" class="org.mybatis.spring.SqlSessionTemplate">
<constructor-arg index="0" ref="sqlSessionFactoryScada"/>
</bean>
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.sipai.mapper.scada" />
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactoryScada" />
</bean>
<!-- (事务管理)transaction manager, use JtaTransactionManager for global tx -->
<bean id="transactionManagerScada"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSourceScada" />
</bean>
<!-- enable transaction annotation support -->
<tx:annotation-driven transaction-manager="transactionManagerScada" />
<!-- 需要将流程引擎的事务托管给spring统一管理 -->
<!-- <tx:advice id="txAdviceScada" transaction-manager="transactionManagerScada">
<tx:attributes>
<tx:method name="start*" propagation="REQUIRED"/>
<tx:method name="execute*" propagation="REQUIRED"/>
<tx:method name="save*" propagation="REQUIRED"/>
<tx:method name="delete*" propagation="REQUIRED" />
<tx:method name="update*" propagation="REQUIRED" />
<tx:method name="remove*" propagation="REQUIRED" />
<tx:method name="assign*" propagation="REQUIRED" />
<tx:method name="create*" propagation="REQUIRED" />
<tx:method name="complete*" propagation="REQUIRED" />
<tx:method name="finish*" propagation="REQUIRED" />
<tx:method name="terminate*" propagation="REQUIRED" />
<tx:method name="take*" propagation="REQUIRED" />
<tx:method name="deploy*" propagation="REQUIRED" />
<tx:method name="undeploy*" propagation="REQUIRED" />
<tx:method name="redeploy*" propagation="REQUIRED" />
<tx:method name="get*" propagation="REQUIRED" read-only="true" />
<tx:method name="find*" propagation="REQUIRED" read-only="true" />
<tx:method name="query*" propagation="REQUIRED" read-only="true" />
<tx:method name="search*" propagation="REQUIRED" read-only="true" />
<tx:method name="is*" propagation="REQUIRED" read-only="true" />
<tx:method name="*" propagation="REQUIRED" />
</tx:attributes>
</tx:advice> -->
</beans>