<?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">
<bean id="txManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attributes>
<tx:method name="add*" propagation="REQUIRED" />
<tx:method name="delete*" propagation="REQUIRED" />
<tx:method name="update*" propagation="REQUIRED" />
<tx:method name="*" propagation="SUPPORTS" />
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="txpointcut"
expression="execution(* com.suplayer.games.dao.*.*.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="txpointcut" />
</aop:config>
<bean id="datasource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="com.mysql.jdbc.Driver">
</property>
<property name="url"
value="jdbc:mysql://10.30.120.13:3306/suplayer?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true">
</property>
<property name="username" value="root"></property>
<property name="password" value="root"></property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="datasource" />
</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/suplayer/games/entity/Active.hbm.xml</value>
<value>
com/suplayer/games/entity/ActiveParticipant.hbm.xml
</value>
<value>com/suplayer/games/entity/Album.hbm.xml</value>
<value>com/suplayer/games/entity/Area.hbm.xml</value>
<value>
com/suplayer/games/entity/Association.hbm.xml
</value>
<value>
com/suplayer/games/entity/AssociationMessage.hbm.xml
</value>
<value>
com/suplayer/games/entity/AssociationUser.hbm.xml
</value>
<value>
com/suplayer/games/entity/BasicInformation.hbm.xml
</value>
<value>
com/suplayer/games/entity/Category.hbm.xml
</value>
<value>
com/suplayer/games/entity/Collection.hbm.xml
</value>
<value>
com/suplayer/games/entity/EnumItem.hbm.xml
</value>
<value>com/suplayer/games/entity/Enums.hbm.xml</value>
<value>
com/suplayer/games/entity/Evaluation.hbm.xml
</value>
<value>
com/suplayer/games/entity/Feedback.hbm.xml
</value>
<value>com/suplayer/games/entity/Friend.hbm.xml</value>
<value>com/suplayer/games/entity/Game.hbm.xml</value>
<value>com/suplayer/games/entity/Issue.hbm.xml</value>
<value>
com/suplayer/games/entity/IssueAnswer.hbm.xml
</value>
<value>com/suplayer/games/entity/Letter.hbm.xml</value>
<value>
com/suplayer/games/entity/Messages.hbm.xml
</value>
<value>com/suplayer/games/entity/Photo.hbm.xml</value>
<value>
com/suplayer/games/entity/Register.hbm.xml
</value>
<value>com/suplayer/games/entity/Sound.hbm.xml</value>
<value>
com/suplayer/games/entity/Subscription.hbm.xml
</value>
<value>
com/suplayer/games/entity/UserGame.hbm.xml
</value>
<value>
com/suplayer/games/entity/UserHeader.hbm.xml
</value>
<value>
com/suplayer/games/entity/Userinfo.hbm.xml
</value>
<value>
com/suplayer/games/entity/UserMail.hbm.xml
</value>
<value>
com/suplayer/games/entity/UserMakeFriendInformation.hbm.xml
</value>
<value>
com/suplayer/games/entity/UserSystemInformation.hbm.xml
</value>
<value>com/suplayer/games/entity/Video.hbm.xml</value>
<value>
com/suplayer/games/entity/ViewVisitor.hbm.xml
</value>
<value>com/suplayer/games/entity/Visitor.hbm.xml</value>
<value>
com/suplayer/games/entity/UserFeedback.hbm.xml
</value>
<value>com/suplayer/games/entity/Patch.hbm.xml</value>
<value>
com/suplayer/games/entity/ActiveMessage.hbm.xml
</value>
<value>
com/suplayer/games/entity/AssociationVisit.hbm.xml
</value>
<value>
com/suplayer/games/entity/SystemImg.hbm.xml
</value>
</list>
</property>
</bean>
<!-- Hibernate Template -->
<bean id="hibernateTemplate"
class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="interceptor" class="servlet.ChangeLoginInterceptor"></bean>
<bean id="userdao"
class="com.suplayer.games.dao.user.impl.UserDaoImpl">
</bean>
<bean id="userbiz"
class="com.suplayer.games.biz.user.impl.UserBizImpl">
<property name="userdao">
<ref bean="userdao"></ref>
</property>
</bean>
<bean id="findByDate"
class="com.suplayer.games.action.user.FindUserByDateAction"
scope="prototype">
<property name="userBiz" ref="userbiz"></property>
</bean>
</beans>
本文介绍了一个使用Spring框架进行事务管理的配置示例。该配置通过声明式事务管理为数据访问层提供事务支持,并详细展示了如何设置事务传播行为以及切入点表达式。
1万+

被折叠的 条评论
为什么被折叠?



