错误:Consider defining a bean of type ‘org.springframework.security.crypto.password.PasswordEncoder‘
解决方法:
换成构造方法注入PassWordEncoder
@Bean
public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
调用:
String password = passwordEncoder().encode(taco.getPassword());