@Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { // Load user from the database (throw exception if not found) User user = userDao.findByUsername(username); if (user == null) { throw new UsernameNotFoundException("User not found"); } // Return user object return user; }
@Override public User findByUsername(String username) { return userDao.findByUsername(username); }