List of usage examples for org.springframework.security.core.userdetails UsernameNotFoundException UsernameNotFoundException
public UsernameNotFoundException(String msg, Throwable t)
From source file:sample.service.impl.UserServiceImpl.java
public UserDetails loadUserByUsername(String username) throws AuthenticationException { try {//from w w w. j av a2s . co m User user = userDAO.findByUsername(username); return new org.springframework.security.core.userdetails.User(user.getUsername(), user.getPassword(), true, true, true, true, AuthorityUtils.createAuthorityList("ROLE_USER")); } catch (Exception e) { LOG.error(e.getMessage(), e); throw new UsernameNotFoundException("No matching account", e); } }