<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="beanID" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="com.mysql.jdbc.Driver">
</property>
<property name="url"
value="jdbc:mysql://localhost:3306/wayfoon?useUnicode=true&characterEncoding=UTF-8">
</property>
<property name="username" value="root"></property>
<property name="password" value="admin"></property>
</bean>
<bean id="sfID"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="beanID" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>com/wayfoon/hibernate/Userinfo.hbm.xml</value>
<value>com/wayfoon/hibernate/Noteinfo.hbm.xml</value>
<value>com/wayfoon/hibernate/Spend.hbm.xml</value>
<value>com/wayfoon/hibernate/Spenddetail.hbm.xml</value>
</list>
</property>
</bean>
<bean id="ht"
class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="sfID"></property>
</bean>
<bean name="/userInfo" class="com.wayfoon.struts.UserInfoAction">
<property name="htmp" ref="ht"></property>
</bean>
<bean name="userInfo" class="com.wayfoon.dao.UserInfoDAOImpl">
<property name="htmp" ref="ht"></property>
</bean>
<bean name="/noteInfo" class="com.wayfoon.struts.NoteInfoAction">
<property name="htmp" ref="ht"></property>
<property name="noteInfoDao" ref="noteInfoDao">
</property>
</bean>
<bean name="noteInfo" class="com.wayfoon.dao.NoteInfoDAOImpl">
<property name="htmp" ref="ht"></property>
</bean>
<bean name="/spend" class="com.wayfoon.struts.SpendAction">
<property name="htmp" ref="ht"></property>
</bean>
<bean name="spend" class="com.wayfoon.dao.UserInfoDAOImpl">
<property name="htmp" ref="ht"></property>
</bean>
<bean name="/spendDetail" class="com.wayfoon.struts.SpenddetailAction">
<property name="htmp" ref="ht"></property>
</bean>
<!--bean name="spendDetail" class="com.wayfoon.dao.UserInfoDAOImpl">
<property name="htmp" ref="ht"></property>
</bean-->
<!-- 声明一个 Hibernate 3 的 事务管理器供代理类自动管理事务用 -->
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sfID">
</property>
</bean>
<bean id="dao"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="proxyInterfaces">
<list>
<value>com.wayfoon.dao.UserInfoDAO</value>
</list>
</property>
<property name="target" ref="userInfo"></property>
<property name="transactionAttributes">
<props>
<prop key="server">PROPAGATION_REQUIRED</prop>
</props>
</property>
<property name="transactionManager" ref="transactionManager"></property>
</bean>
<bean id="noteInfoDao"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<!-- 使用hibernate 接口 代理-->
<property name="proxyInterfaces">
<list>
<value>com.wayfoon.dao.NoteInfoDAO</value>
</list>
</property>
<!-- 使用spring 类代理
<property name="proxyTargetClass">
<value>true</value>
</property>
-->
<property name="target" ref="noteInfo"></property>
<property name="transactionAttributes">
<props>
<prop key="deleteNoteInfo">PROPAGATION_REQUIRED</prop>
</props>
</property>
<property name="transactionManager" ref="transactionManager"></property>
</bean>
</beans>