151617181920212223
private UserRepository userRepository; public User findUser(String name) { User user = userRepository.findByName(name); if (user == null) { throw new UserNotFoundException(name); } return user; }