Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当一个带@Transactional注解的方法抛出异常,但没有在其中声明类时rollbackFor,事务会回滚还是不回滚?
@Transactional
rollbackFor
默认情况下,事务会因未检查的异常(和的子类RuntimeException)Error而回滚,而不会因已检查的异常而回滚。
RuntimeException
Error
可以通过rollbackFor和noRollbackFor属性自定义此行为。
noRollbackFor
也可以看看: