1. 类没被Spring管理 

@Transactional失效的场景-LMLPHP

解决方法: 贴上注解@Service、@Component 等交由Spring管理
2. private修饰的方法

@Transactional失效的场景-LMLPHP

解决方法: 修改成 public, 只有public才生效
3. try{}catch(){只打印异常信息}

@Transactional失效的场景-LMLPHP

 

 
解决方法: 捕获异常,并继续抛出原捕获的异常, 或抛出运行时异常 throw new RuntimeException();

 @Transactional失效的场景-LMLPHP

 

08-09 14:18