0
我有豆進入如下春呼叫所需的方法
<bean id="inspectReqImpl"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager" ref="transactionManager" />
<property name="transactionAttributes">
<props>
<prop key="activateRequest">PROPAGATION_REQUIRES_NEW</prop>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
<property name="target">
<bean
class="com.test.InspectRequestImpl">
</bean>
</property>
</bean>
<bean id="inspectReqProcess"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager" ref="transactionManager" />
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
<property name="target">
<bean
class="com.test.InspectRequestProcessImpl">
</bean>
</property>
</bean>
當我打電話com.test.InspectRequestImpl.activateRequest()方法,那麼Spring將
public void activateRequest()
{
Calling method of InspectRequestProcessImpl(ex: processRequest())
For InspectRequestProcessImpl we have defined all methods as PROPAGATION_REQUIRED
}
因此,創建新的交易如果任何異常(選中或未選中)出現在方法(InspectRequestProcessImpl.processRequest())
中,交易傳播爲REQUIRED
那麼會對交易傳播的InspectRequestImpl.activateRequest()
有什麼影響REQUIRED_NEW
- 春天在這種情況下會如何表現。它會提交
InspectRequestImpl.activateRequest()
還是回滾? - 它只是回滾
InspectRequestProcessImpl.processRequest()
的內容還是會引發異常?