Transactions, Spring.
hence the transaction is rolled back public class UserService { @Autowired UserRespository userRepository; @Transactional public User getUser(String id) throws UserNotEligibleToDriveException{ User user = userRepository.get(id); //Assume user object is null //We get NullPointerException on below