Spring事务配置减去Exception(`-Exception`)的含义

时间:2019-03-29 14:38:48

标签: java spring

我在Spring中有此配置。

-Exception在那里意味着什么(请参见transactionAttributes属性)?

任何具有这些属性的正式文档或教程都在其中?
我的意思是在哪里可以找到文档,该文档如何在XML Spring配置文件中定义这些道具(而不是作为注释)?

    <bean id="proxy_processor"
          class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean" 
          lazy-init="default" 
          autowire="default">

        <property name="transactionManager" ref="hibernateTransactionManager"/>
        <property name="target" ref="processor"/>
        <property name="transactionAttributes">
            <props>
                <prop key="process*">PROPAGATION_REQUIRED,-Exception,readOnly</prop>
            </props>
        </property>
    </bean>

1 个答案:

答案 0 :(得分:2)

您在这里:

setTransactionAttributes

TransactionProxyFactoryBean文档。键是方法名称模式(“ process *”匹配以“ process”等开头的所有方法。)

还有TransactionAttributeEditor javadoc

  

-Exception在那里意味着什么(请参阅transactionAttributes   财产)?

在后一页:

  

在异常名称子字符串之前的“ +”表示交易   即使抛出此异常也应提交;他们应该使用的“-”   回滚。

交易传播类型记录在here中。