springboot的問題

一、事务

PlatformTransactionManager 如果你添加的是 spring-boot-starter-jdbc jar包,框架会默认注入 DataSourceTransactionManager 实例。如果你添加的是 spring-boot-starter-data-jpa  jar包,框架会默认注入 JpaTransactionManager 实例。

@EnableTransactionManagement
@SpringBootApplication
@ComponentScan
public class signRestApplication extends SpringBootServletInitializer{}

 

@EnableTransactionManagement (等同于xml配置文件中的 <tx:annotation-driven />)

运行signRestApplication 时启动事务管理,在service上加上@Transactional实现事务管理

posted @ 2017-05-10 11:28  无敌的小小哒  阅读(143)  评论(0编辑  收藏  举报