可能原因:
1.密码或用户名错误
2.密码加密问题
解决方法(在data.getPassword()前加上"{noop}"+):
return User
.withUsername(data.getUsername())
.password("{noop}"+data.getPassword())
.roles(data.getRole())
.build();
3.编码问题(利用new BCryptPasswordEncoder().encode()解码):
return User
.withUsername(data.getUsername())
.password(new BCryptPasswordEncoder().encode(data.getPassword()))
.roles(data.getRole())
.build();