首先我需要在xml文件中声明.我要进行自定义用户的认证类,也就是我要自己从数据库中进行查询
authorities = new HashSet<>(); authorities.add(new SimpleGrantedAuthority("ROLE_SELLER")); //将这个用户的信息返回给认证类 return new User(username,seller.getPassword(),authorities); } } //没有这个用户,则返回null return null; } public UserDetailServiceImpl(SellerService sellerService) { this.sellerService = sellerService; } public SellerService getSellerService() { return sellerService; } public void setSellerService(SellerService sellerService) { this.sellerService = sellerService; } }
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持考高分网。



