Spring transaction Configuration

Source: Internet
Author: User

<? 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: 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
">

<! -- Configure sessionfactory -->
<Bean id = "sessionfactory"
Class = "org. springframework. Orm. hibernate3.localsessionfactorybean">
<Property name = "configlocation">
<Value> classpath: hibernate. cfg. xml </value>
</Property>
</Bean>

<! --- The bean of the playing environment->

<Bean id = "springcontextutil" class = "com. hongdian. ibridge. util. springcontextutil"/>

<! -- Configure the Transaction Manager -->
<Bean id = "transactionmanager"
Class = "org. springframework. Orm. hibernate3.hibernatetransactionmanager">
<Property name = "sessionfactory">
<Ref bean = "sessionfactory"/>
</Property>
</Bean>

<! -- Configure the propagation feature of transactions -->
<TX: Advice id = "txadvice" transaction-Manager = "transactionmanager">
<TX: Attributes>
<! -- Set transactions with the save, Del, and up letters -->
<TX: method name = "Save *" propagation = "required"/>
<TX: method name = "del *" propagation = "required"/>
<TX: method name = "up *" propagation = "required"/>
<TX: method name = "merge *" propagation = "required"/>

<! -- Add a log transaction: Add a log when sending a command. The method starts with get. -->
<TX: method name = "get" propagation = "required"/>

<! -- Other methods do not enable transactions to improve performance -->
<TX: method name = "*" propagation = "not_supported"/>
</TX: Attributes>
</TX: Advice>

<! -- Configure the method for participating in the transaction -->
<AOP: config>
<AOP: pointcut id = "businesslogicservices" expression = "execution (* COM. hongdian. ibridge... * (...)"/>
<AOP: Advisor pointcut-ref = "businesslogicservices" advice-ref = "txadvice"/>
</AOP: config>

<! -- AOP -->
<AOP: aspectj-autoproxy proxy-target-class = "true"/>

<! -- File Upload -->
<Bean id = "multipartresolver" class = "org. springframework. Web. multipart. commons. commonsmultipartresolver">
<Property name = "maxuploadsize" value = "10000000"/>
</Bean>
</Beans>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.