@EnableTransactionManagement 该注解置于spring-boot 启动类上 意义 该注解表示开启事务支持 在springboot项目中一般配置在启动类上 效果等同于一般spring中 xml配置的<tx:annotation-driven />。 开启事务支持后,然后在访问数据库的Service方法上添加注解 @Transactional 后当前方法将支持事务。 放在类上时 所有方法支持事务