ssh框架整合 applicationContext.xml

<?xmlversion="1.0"encoding="UTF-8"?>

<beansxmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:context="http://www.springframework.org/schema/context"

xmlns:p="http://www.springframework.org/schema/p"xmlns:aop="http://www.springframework.org/schema/aop"xmlns:tx="http://www.springframework.org/schema/tx"

xsi:schemaLocation="http://www.springframework.org/schema/beans

http://www.springframework.org/schema/beans/spring-beans-2.5.xsd

http://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context-2.5.xsd

http://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop-2.5.xsd

http://www.springframework.org/schema/txhttp://www.springframework.org/schema/tx/spring-tx-2.5.xsd">

<!--开启注解配置-->

<context:annotation-config/>

<!--对指定的包进行组件扫描--><!--##########此处加包模块###########-->

<context:component-scanbase-package="com.donglusoft.leavedemo"/>

<context:component-scanbase-package="com.donglusoft.bacterin"/>

<context:component-scanbase-package="com.donglusoft.charge"/>

<context:component-scanbase-package="com.donglusoft.goods"/>

<context:component-scanbase-package="com.donglusoft.stat"/>

<context:component-scanbase-package="com.donglusoft.healthcard"/>

<context:component-scanbase-package="com.donglusoft.hygienemonitor"/>

<context:component-scanbase-package="com.donglusoft.license"/>

<context:component-scanbase-package="com.donglusoft.officialdocument"/>

<context:component-scanbase-package="com.donglusoft.person"/>

<context:component-scanbase-package="com.donglusoft.rightmanagement"/>

<context:component-scanbase-package="com.donglusoft.sampletesting"/>

<context:component-scanbase-package="com.donglusoft.vehicle"/>

<!--读取配置文件-->

<beanid="propertyConfigurer"class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">

<propertyname="locations">

<list>

<value>classpath*:conf/properties/jdbc.properties</value>

<value>classpath*:conf/properties/hibernate.properties</value>

</list>

</property>

</bean>

<!--配置数据源,导入c3p0-0.9.1.2.jar-->

<beanid="dataSourceImpl"class="com.mchange.v2.c3p0.ComboPooledDataSource"destroy-method="close">

<propertyname="driverClass"value="${jdbc.driverClassName}"/>

<propertyname="jdbcUrl"value="${jdbc.url}"/>

<propertyname="user"value="${jdbc.username}"/>

<propertyname="password"value="${jdbc.password}"/>

<!--连接池中保留的最小连接数。-->

<propertyname="minPoolSize"value="5"/>

<!--连接池中保留的最大连接数。Default:15-->

<propertyname="maxPoolSize"value="30"/>

<!--初始化时获取的连接数,取值应在minPoolSize与maxPoolSize之间。Default:3-->

<propertyname="initialPoolSize"value="10"/>

<!--最大空闲时间,600秒内未使用则连接被丢弃。若为0则永不丢弃。Default:0-->

<propertyname="maxIdleTime"value="600"/>

<!--当连接池中的连接耗尽的时候c3p0一次同时获取的连接数。Default:3-->

<propertyname="acquireIncrement"value="5"/>

<!--JDBC的标准参数,用以控制数据源内加载的PreparedStatements数量。但由于预缓存的statements

属于单个connection而不是整个连接池。所以设置这个参数需要考虑到多方面的因素。如果maxStatements与maxStatementsPerConnection均为0,则缓存被关闭。Default:0-->

<propertyname="maxStatements"value="0"/>

</bean>

<!--用p6spy在console显示变量绑定后的真实sql与ResultSet,方便开发-->

<beanid="dataSource"class="com.p6spy.engine.spy.P6DataSource">

<constructor-argref="dataSourceImpl"/>

</bean>

<!--集成hibernate配置-->

<beanid="sessionFactory"class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">

<propertyname="dataSource"ref="dataSourceImpl"/>

<propertyname="hibernateProperties"ref="hibernateProperties"/>

<propertyname="mappingLocations">

<list>

<!--以下几个jbpm.*.hbm.xml由jBPM自带-->

<value>classpath:jbpm.repository.hbm.xml</value>

<value>classpath:jbpm.execution.hbm.xml</value>

<value>classpath:jbpm.history.hbm.xml</value>

<value>classpath:jbpm.task.hbm.xml</value>

<value>classpath:jbpm.identity.hbm.xml</value>

<!--#####华丽丽而又非常华丽丽的分界线####=====注意可以使用通配符======###-->

<value>classpath*:com/donglusoft/leavedemo/entities/*.hbm.xml</value>

<value>classpath*:com/donglusoft/bacterin/domain/*.hbm.xml</value>

<value>classpath*:com/donglusoft/charge/domain/*.hbm.xml</value>

<value>classpath*:com/donglusoft/goods/domain/*.hbm.xml</value>

<value>classpath*:com/donglusoft/healthcard/domain/*.hbm.xml</value>

<value>classpath*:com/donglusoft/hygienemonitor/domain/*.hbm.xml</value>

<value>classpath*:com/donglusoft/license/domain/*.hbm.xml</value>

<value>classpath*:com/donglusoft/officialdocument/domain/*.hbm.xml</value>

<value>classpath*:com/donglusoft/person/domain/*.hbm.xml</value>

<value>classpath*:com/donglusoft/rightmanagement/domain/*.hbm.xml</value>

<value>classpath*:com/donglusoft/sampletesting/domain/*.hbm.xml</value>

<value>classpath*:com/donglusoft/vehicle/domain/*.hbm.xml</value>

</list>

</property>

</bean>

<beanname="hibernateProperties"class="org.springframework.beans.factory.config.PropertiesFactoryBean">

<propertyname="properties">

<props>

<!--当你使用mysql的时候,jbpm使用的是org.hibernate.dialect.MySQLInnoDBDialect-->

<propkey="hibernate.dialect">${hibernate.dialect}</prop>

<propkey="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>

<propkey="hibernate.jdbc.fetch_size">${hibernate.jdbc.fetch_size}</prop>

<propkey="hibernate.jdbc.batch_size">${hibernate.jdbc.batch_size}</prop>

<propkey="hibernate.show_sql">${hibernate.show_sql}</prop>

<propkey="hibernate.format_sql">${hibernate.format_sql}</prop>

<propkey="hibernate.use_sql_comments">${hibernate.use_sql_comments}</prop>

<propkey="hibernate.connection.driver_class">${hibernate.connection.driver_class}</prop>

<!--Hibernate的缓存部分,可以不用,直接在DAO层进行配置二级缓存-->

<propkey="hibernate.cache.provider_class">${hibernate.cache.provider_class}</prop>

<propkey="hibernate.cache.use_query_cache">${hibernate.cache.use_query_cache}</prop>

<propkey="hibernate.cache.provider_configuration_file_resource_path">${hibernate.cache.provider_configuration_file_resource_path}</prop>

</props>

</property>

</bean>

<!--jbpm配置-->

<beanid="springHelper"class="org.jbpm.pvm.internal.processengine.SpringHelper"/>

<beanid="processEngine"factory-bean="springHelper"factory-method="createProcessEngine"/>

<!--模板配置自己写的,不是必须的-->

<beanid="jbpmTemplate"class="com.donglusoft.zzz.util.JbpmTemplate">

<propertyname="processEngine"ref="processEngine"></property>

</bean>

<!--数据层用的模板工具,不是必须的-->

<beanid="hibernateTemplate"class="org.springframework.orm.hibernate3.HibernateTemplate">

<propertyname="sessionFactory"ref="sessionFactory"></property>

</bean>

<!--事务配置,必须-->

<beanid="transactionManager"class="org.springframework.orm.hibernate3.HibernateTransactionManager"abstract="false"lazy-init="default"autowire="default"dependency-check="default">

<propertyname="sessionFactory"ref="sessionFactory"/>

</bean>

<!--切面配置-->

<aop:config>

<aop:pointcutid="transactionPointcut1"expression="execution(*com.donglusoft.leavedemo.biz.*.*(..))"/>

<aop:pointcutid="transactionPointcut2"expression="execution(*com.donglusoft.bacterin.service.*.*(..))"/>

<aop:pointcutid="transactionPointcut3"expression="execution(*com.donglusoft.charge.service.*.*(..))"/>

<aop:pointcutid="transactionPointcut4"expression="execution(*com.donglusoft.goods.service.*.*(..))"/>

<aop:pointcutid="transactionPointcut5"expression="execution(*com.donglusoft.healthcard.service.*.*(..))"/>

<aop:pointcutid="transactionPointcut6"expression="execution(*com.donglusoft.hygienemonitor.service.*.*(..))"/>

<aop:pointcutid="transactionPointcut7"expression="execution(*com.donglusoft.license.service.*.*(..))"/>

<aop:pointcutid="transactionPointcut8"expression="execution(*com.donglusoft.officialdocument.service.*.*(..))"/>

<aop:pointcutid="transactionPointcut9"expression="execution(*com.donglusoft.person.service.*.*(..))"/>

<aop:pointcutid="transactionPointcut10"expression="execution(*com.donglusoft.rightmanagement.service.*.*(..))"/>

<aop:pointcutid="transactionPointcut11"expression="execution(*com.donglusoft.sampletesting.service.*.*(..))"/>

<aop:pointcutid="transactionPointcut12"expression="execution(*com.donglusoft.vehicle.service.*.*(..))"/>

<aop:pointcutid="transactionPointcut13"expression="execution(*com.donglusoft.leavedemo.service.*.*(..))"/>

<aop:advisoradvice-ref="txAdvice"pointcut-ref="transactionPointcut1"/>

<aop:advisoradvice-ref="txAdvice"pointcut-ref="transactionPointcut2"/>

<aop:advisoradvice-ref="txAdvice"pointcut-ref="transactionPointcut3"/>

<aop:advisoradvice-ref="txAdvice"pointcut-ref="transactionPointcut4"/>

<aop:advisoradvice-ref="txAdvice"pointcut-ref="transactionPointcut5"/>

<aop:advisoradvice-ref="txAdvice"pointcut-ref="transactionPointcut6"/>

<aop:advisoradvice-ref="txAdvice"pointcut-ref="transactionPointcut7"/>

<aop:advisoradvice-ref="txAdvice"pointcut-ref="transactionPointcut8"/>

<aop:advisoradvice-ref="txAdvice"pointcut-ref="transactionPointcut9"/>

<aop:advisoradvice-ref="txAdvice"pointcut-ref="transactionPointcut10"/>

<aop:advisoradvice-ref="txAdvice"pointcut-ref="transactionPointcut11"/>

<aop:advisoradvice-ref="txAdvice"pointcut-ref="transactionPointcut12"/>

<aop:advisoradvice-ref="txAdvice"pointcut-ref="transactionPointcut13"/>

</aop:config>

<tx:adviceid="txAdvice"transaction-manager="transactionManager">

<tx:attributes>

<tx:methodname="get*"read-only="true"propagation="NOT_SUPPORTED"/>

<tx:methodname="find*"read-only="true"propagation="NOT_SUPPORTED"/>

<tx:methodname="*"propagation="REQUIRED"/>

<!--

<tx:methodname="add*"propagation="REQUIRED"/><tx:methodname="del*"propagation="REQUIRED"/><tx:methodname="update*"propagation="REQUIRED"/><tx:methodname="*"

propagation="REQUIRED"/><tx:methodname="get*"propagation="SUPPORTS"read-only="true"/><tx:methodname="search*"propagation="SUPPORTS"read-only="true"/>

-->

</tx:attributes>

</tx:advice>

</beans>

相关推荐