使用spring security5.0后,配置文件中直接写普通的密码如:123456,会报错:

java.lang.IllegalArgumentException: There is no PasswordEncoder mapped for the id "null"

这是因为spring security5.0以后默认需要选择密码加密方式,如果还像之前版本直接配置未加密密码,就会报上面这个错误当然啦,如果还想用简单密码的话,spring security还是给了两个方案,一种是在配置文件中配置:

<bean />

l另一种就是在你配置密码那里加上{noop}如:{noop}123456

<security:user name="zhangsan" password="zhangsan" authorities="ROLE_ADMIN"/>

相关文章:

猜你喜欢
相关资源
相似解决方案