public class UserDetailServiceImpl implements UserDetailsService {
// Use xml to inject
private SellerService sellerService;
public void setSellerService(SellerServiceService) {< br /> this.sellerService = sellerService;
}
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
if (username == null || "".equals(username)) {
return null;
}
Seller seller = sellerService.findByName(username);
if(seller != null) {
ListgrantedAuthorities = new ArrayList<>();
GrantedAuthority grantedAuthority = new SimpleGrantedAuthority("ROLE_SELLER");
grantedAuthorities.add(grantedAuthority);
return new User(username, seller.getPassword(), grantedAuthorities);
}
return null;
}
}
< p>