springboot 2.0开启事务

1

  jpa:
    show-sql: true
    hibernate:
      ddl-auto: update
    database-platform: org.hibernate.dialect.MySQL5InnoDBDialect  #不加这句则默认为myisam引擎

2

@SpringBootApplication
@EnableTransactionManagement
public class MyLeadingApplication {

    public static void main(String[] args) {
        SpringApplication.run(MyLeadingApplication.class, args);
    }

}

3 @Transactional添加到类或者是公开的方法上!

你可能感兴趣的:(springboot 2.0开启事务)