spring configuration xml-based declarative transaction

    <! - Configure Spring's declarative transaction management -> 
    <! - Configure Transaction Manager -> 
    < bean the above mentioned id = "transactionManager" class = "org.springframework.jdbc.datasource.DataSourceTransactionManager" > 
        < Property name = "dataSource" ref = "dataSource" /> 
    </ bean > 

    <-! open the annotation-driven transaction -> 
    <-! <tx: transaction-driven-annotation Manager = "transactionManager" /> -> 

    < tx: the advice ID = "txAdvice" Transaction Manager- = "transactionManager">
        <tx:attributes> 
            <! - Other methods require a transaction -> 
            < tx: Method, name = "*" propagation = "REQUIRED" the Read-only = "false" /> 
            < tx: Method, name = "GET *" the Read-only = " to true "  /> 
            < tx: Method, name =" Query * " the Read-only =" to true "  /> 
            < tx: Method, name =" the Find * " the Read-only =" to true "  /> 
            ! <- New transaction, if in current affairs, current affairs put suspend -> 
            < tx:method name="requiresNew*" propagation="REQUIRES_NEW"/> 
            <! - performing operations in the form of non-transactional, if the current transaction is present, leave the current pending transaction -> 
            < TX: Method name = "NotSupported *" propagation = "NOT_SUPPORTED" /> 
        </ TX: Attributes > 
    </ TX: the advice > 

    < AOP: config > 
        < AOP: Advisor ID = "TX" the advice-REF = "txAdvice" the pointcut = "Execution (com.alphajuns.service.impl * * * (..)..) " /> 
        <! - configuration pointcut expression -> 
        <-! <AOP: the pointcut ID =" PT1 "= expression The" Execution (com.alphajuns.service.impl * * * (....))"></aop:pointcut>-->
        <!--Correspondence between the entry point for the establishment of expression and transaction notifications -> 
        <-! <AOP: Advisor advice-ref = "txAdvice" pointcut-ref = "PT1"> </ AOP: Advisor> -> 
    </ AOP: config >

 

Guess you like

Origin www.cnblogs.com/alphajuns/p/12669488.html