@Transactional遇到try catch失效

Springboot中@Transactional遇到了try catch失效了,需要手动回滚

try {
                        user.setExpire(Integer.parseInt(expire));
                        userService.updateById(user);
                        Host host = hostService.getById(user.getHostId());//查询数据库的host信息
                        updateResponse = proxmoxConfig.updateEffectiveTime(user.getUserName(), expire, host.getHostUrlRequest());
                    } catch (Exception e) {
                        e.printStackTrace();
                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                    }

你可能感兴趣的:(java,框架)