<?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.0.xsd 
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd 
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd" 
default-autowire="byName" default-lazy-init="true"> -->
<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: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-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-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/tx
         http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
<!-- 属性文件读入 -->
<!-- <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> 
<property name="locations"> <list> <value>classpath*:hibernate.properties</value> 
</list> </property> </bean> --> <!-- 配置连接参数 -->
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location"
value="file:E:/eclipse-workspace/Test/config/jdbc.properties" />
</bean>
<!-- 配置数据源 -->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<!-- 基本配置 -->
<property name="jdbcUrl" value="${url}"></property>
<property name="driverClass" value="${driverClass}"></property>
<property name="user" value="${username}"></property>
<property name="password" value="${password}"></property>
<!-- 其他参数配置 -->
<property name="acquireIncrement" value="2" />
<property name="maxIdleTime" value="10" />
<property name="maxPoolSize" value="50" />
<property name="initialPoolSize" value="2" />
<property name="minPoolSize" value="2" />
</bean>
<!-- 配置sessionFactory -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<!-- 配置数据源 -->
<property name="dataSource" ref="dataSource"></property>
<property name="mappingDirectoryLocations"
value="file:E:/eclipse-workspace/Test/config/hibernate"></property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">false</prop>
</props>
</property>
</bean> <!-- 配置hibernateTemplate -->
<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean> <bean id="exportDateDao" class="cn.com.trueway.dao.impl.ExportDateDaoImpl"
scope="prototype">
<property name="hibernateTemplate" ref="hibernateTemplate"></property>
</bean>
<bean id="exportDateService" class="cn.com.trueway.service.impl.ExportDateServiceImpl"
scope="prototype">
<property name="exportDateDao" ref="exportDateDao"></property>
</bean>
<!-- 配置advice -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="query*" read-only="true" propagation="REQUIRED" />
</tx:attributes>
</tx:advice>
<!-- 配置切入点 -->
<aop:config>
<aop:pointcut id="testServicePointCut"
expression="execution(* cn.com.trueway.service.impl.*.*(..))" />
<aop:pointcut id="testDaoPointCut"
expression="execution(* cn.com.trueway.dao.impl.*.*(..))" /> <aop:advisor advice-ref="txadvice" pointcut-ref="testServicePointCut" />
<aop:advisor advice-ref="txadvice" pointcut-ref="testDaoPointCut" /> </aop:config>
<!-- 配置dao -->
<context:component-scan base-package="cn.com.trueway.dao" />
<!-- 配置service -->
<context:component-scan base-package="cn.com.trueway.service" />
</beans>