因此,我建立了一个测试用例,简单的答案是肯定的。
事务逻辑作用域包含事务属性,其边界确实是带注释的方法边界。
因此,即使两种方法的基础物理事务都相同,逻辑属性也适合于每种方法,而内部方法可以强制回退外部方法事务。但是,如果最后一次触发提交,则会导致UnexpectedRollbackException。
cf. Spring TransactionInterceptor(评论是我的)
try { retVal = invocation.proceed();}catch (Throwable ex) { completeTransactionAfterThrowing(txInfo, ex); throw ex;}completeTransactionAfterThrowing():
// txinfo is proper to the invocation target methodif (txInfo.transactionAttribute.rollbackOn(ex)) { try { txInfo.getTransactionManager().rollback(txInfo.getTransactionStatus()); }AbstractPlatformTransactionManager.processRollback():
else if (status.isNewTransaction()) { //requiresnew doRollback(status);}else if (status.hasTransaction()) { //requiered [...] doSetRollbackonly(status); }}


