Transactions, Spring.
@Transactional(rollbackFor=UserNotEligibleToDriveException.class) public User getUser(String id) throws UserNotEligibleToDriveException{ //code here} We can also specify rollbackFor=Exception.class to inform Spring Boot to rollback the transaction for any checked exceptions. In this way, we dont