<?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">
<!-- Session 工厂 -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation"
value="classpath:hibernate.cfg.xml"><!-- 可以不要配置文件(hibernate.cfg.xml),直接写在这个Spring的配置文件中 -->
</property>
</bean>
<!-- 模板 -->
<bean id="hibernateTemplate"
class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<!-- 事务器 -->
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<!-- 对外代理 -->
<!-- 1,用户管理 -->
<bean id="userDaoImp"
class="com.ygkq.usermanager.model.dao.hibernate.UserDaoImp">
<property name="hibernateTemplate" ref="hibernateTemplate" />
</bean>
<bean id="userServiceTarget"
class="com.ygkq.usermanager.model.service.spring.UserServiceImp">
<property name="userdao">
<ref local="userDaoImp" />
</property>
</bean>
<bean id="userService"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager">
<ref local="transactionManager" />
</property>
<property name="target">
<ref local="userServiceTarget" />
</property>
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
</beans>