1. 检查你方法是否是public的。mysql
2. 你的异常类型是否是unchecked异常。
若是我想check异常也想回滚怎么办,注解上面写明异常类型便可。spring
@Transactional(rollbackFor=Exception.class)
相似的还有norollbackFor,自定义不回滚的异常。sql
3. 数据库引擎要支持事务,若是是mysql,注意表要使用支持事务的引擎,好比innodb,若是是myisam,事务是不起做用的。数据库
4. 是否开启了对注解的解析(SpringBoot使用@EnableTransactionManagement注解)code
<tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/>
5. spring是否扫描到你这个包,以下是扫描到org.test下面的包(SpringBoot使用@SpringBootApplication注解)component
<context:component-scan base-package="org.test" ></context:component-scan>