<?xml version="1.0" encoding="UTF-8"?>
<!--导入标签描述 -->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
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
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
">
<!-- 创建会话工厂 -->
<bean id="sf"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation"
value="classpath:hibernate.cfg.xml">
</property>
</bean>
<!-- 事务管理器 -->
<bean id="transactionManage"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sf"></property>
</bean>
<!-- 事务通知 -->
<tx:advice id="tranAdvice"
transaction-manager="transactionManage">
<tx:attributes>
<tx:method name="*" />
<tx:method name="find*" read-only="true" />
</tx:attributes>
</tx:advice>
<!-- 织入AOP事务支持 -->
<aop:config>
<aop:advisor pointcut="execution(* com.xxx.biz.*.*(..))"
advice-ref="tranAdvice" />
</aop:config>
<!-- 公用DAO类 -->
<bean id="ICommDao" class="com.xxx.dao.impl.CommonDao">
<property name="sessionFactory" ref="sf" />
</bean>
<!-- BIZ -->
<bean id="IUserBIZ" class="com.xxx.biz.impl.UserBiz">
<property name="dao" ref="ICommDao"></property>
</bean>
<!-- ACIONT -->
<bean name="/user" class="com.xxx.web.action.UserAction">
<property name="IUserBiz" ref="IUserBIZ"></property>
</bean>
</beans>