添加事务处理

Mybatis-Kits 没有对事务处理做任何更改,你完全参照 mybatis-spring 事务处理 配置你的事务就可以了。

一个简单的使用方法是在任何你想使用事务的服务类上加上 @Transactional 注解就可以了。

@Transactional(propagation = Propagation.REQUIRED, rollbackFor = RuntimeException.class)
public class UserServiceImpl {
    
    private static final Logger LOGGER = LoggerFactory.getLogger(UserServiceImpl.class);

	@Autowired
	UserMapper userMapper;
	
	@Autowired
	OrderMapper orderMapper;

    public String getNewId() {
        return IdUtils.getNewId(getClass());
    }

}