SpringBoot-事务

来源:互联网 发布:凤岗数控车床编程培训 编辑:程序博客网 时间:2024/06/03 10:59
1.启动类加@EnableTransactionManagement注解@SpringBootApplication@EnableTransactionManagementpublic class XXXXXApplication {    public static void main(String[] args) {        XXXXXApplication.run(AvacarVehicleApplication.class, args);    }}2.需要加事务的方法上加@Transactional@Transactionalpublic void adddata(Entity e) {        xxxxxMapper.insert(e);        xxxxxMapper.update(e);}
原创粉丝点击