115 lines
4.0 KiB
XML
115 lines
4.0 KiB
XML
<?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: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/context http://www.springframework.org/s ... ing-context-2.5.xsd
|
|
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
|
|
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd"
|
|
default-autowire="byName" default-lazy-init="true">
|
|
<!--
|
|
<bean id="sessionFactory"
|
|
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
|
|
</bean>
|
|
-->
|
|
<bean id="propertyConfigurer"
|
|
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
|
|
<property name="locations">
|
|
<list>
|
|
<value>WEB-INF/classes/hibernate/jdbc.properties</value>
|
|
</list>
|
|
</property>
|
|
</bean>
|
|
|
|
<bean id="myDataSource"
|
|
class="com.mchange.v2.c3p0.ComboPooledDataSource"
|
|
destroy-method="close" dependency-check="none">
|
|
<property name="driverClass">
|
|
<value>${jdbc.driver}</value>
|
|
</property>
|
|
<property name="jdbcUrl">
|
|
<value>${jdbc.url}</value>
|
|
</property>
|
|
<property name="user">
|
|
<value>${jdbc.username}</value>
|
|
</property>
|
|
<property name="password">
|
|
<value>${jdbc.password}</value>
|
|
</property>
|
|
<property name="acquireIncrement">
|
|
<value>${c3p0.acquireIncrement}</value>
|
|
</property>
|
|
<property name="initialPoolSize">
|
|
<value>${c3p0.initialPoolSize}</value>
|
|
</property>
|
|
<property name="minPoolSize">
|
|
<value>${c3p0.minPoolSize}</value>
|
|
</property>
|
|
<property name="maxPoolSize">
|
|
<value>${c3p0.maxPoolSize}</value>
|
|
</property>
|
|
<property name="maxIdleTime">
|
|
<value>${c3p0.maxIdleTime}</value>
|
|
</property>
|
|
<property name="idleConnectionTestPeriod">
|
|
<value>${c3p0.idleConnectionTestPeriod}</value>
|
|
</property>
|
|
<property name="maxStatements">
|
|
<value>${c3p0.maxStatements}</value>
|
|
</property>
|
|
<property name="numHelperThreads">
|
|
<value>${c3p0.numHelperThreads}</value>
|
|
</property>
|
|
</bean>
|
|
|
|
|
|
<bean id="mycatInterceptor" class="nis.nms.persistence.MycatInterceptor"/>
|
|
|
|
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
|
|
<property name="dataSource" ref="myDataSource" />
|
|
<property name="mappingDirectoryLocations">
|
|
<list>
|
|
<value>/WEB-INF/classes/nis/nms/domains/</value>
|
|
</list>
|
|
</property>
|
|
<property name="hibernateProperties">
|
|
<props>
|
|
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
|
|
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
|
|
<prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
|
|
<prop key="hibernate.jdbc.fetch_size">${hibernate.jdbc.fetch_size}</prop>
|
|
<prop key="hibernate.jdbc.batch_size">${hibernate.jdbc.batch_size}</prop>
|
|
<prop key="hibernate.current_session_context_class">thread</prop>
|
|
</props>
|
|
</property>
|
|
<property name="entityInterceptor" ref="mycatInterceptor"></property>
|
|
</bean>
|
|
|
|
|
|
<!-- <bean id="transactionManager"
|
|
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
|
|
<property name="dataSource" ref="myDataSource" />
|
|
</bean> -->
|
|
|
|
|
|
|
|
|
|
<!-- <aop:config proxy-target-class="true">
|
|
<aop:advisor pointcut="execution(* nis.nms.service..*Service.*(..))" advice-ref="txAdvice" />
|
|
<aop:advisor pointcut="execution(* nis.nms.persistence.*Dao.*(..))" advice-ref="txAdvice"/>
|
|
</aop:config> -->
|
|
|
|
|
|
|
|
<!-- 定义transactionManager作事务管理,get*方法事务为readonly,其它方法按默认设置 -->
|
|
<!-- <tx:advice id="txAdvice">
|
|
<tx:attributes>
|
|
<tx:method name="get*" read-only="true" />
|
|
<tx:method name="find*" read-only="true" />
|
|
<tx:method name="*" />
|
|
</tx:attributes>
|
|
</tx:advice> -->
|
|
|
|
</beans>
|