@Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { logger.info("登陆用户名:"+username); //根据用户名查找 可以采用多种查询数据库 这里暂时先写死了 return new User(username,"123456", AuthorityUtils.commaSeparatedStringToAuthorityList("admin"));
出现问题 访问的 登陆页面 输入错误 的 密码 和 用户名的时候 直接 返回错误 There is no PasswordEncoder mapped for the id “null”
现在 采用这个 方法
return new User(username,"{noop}123456", AuthorityUtils.commaSeparatedStringToAuthorityList("{noop}admin"));
问题解决
问题原因 https://www.mkyong.com/spring-boot/spring-security-there-is-no-passwordencoder-mapped-for-the-id-null/