spring 事务注解 需要捕获的throw new Exception("...");不会回滚
@Transactional(rollbackFor=class)
public void methodName() {
// 会回滚
throw new Exception("...");
// 会回滚
throw new RuntimeException("...");
}
rollbackFor 默认就是 RuntimeException
@Transactional(rollbackFor=class) 或者是 @Transactional()
public ItimDaoImpl getItemDaoImpl() {
// 不会回滚
throw new Exception("...");
// 会回滚
throw new RuntimeException("");
}