チャンドラ:
私の設定:
@Autowired
private PasswordEncoder passwordEncoder;
@Bean
public PasswordEncoder passwordEncoderBean() {
return new BCryptPasswordEncoder();
}
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}
// @Autowired
@Override
public void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.userDetailsService(jwtUserDetailsService)
.passwordEncoder(passwordEncoder);
}
このコードは、罰金に動作します。私は削除する場合しかし@Autowired
からpasswordEncoder
、私は追加する必要があります@Autowired
上のconfigure
方法。しかし、このルールはないに適用するauthenticationManagerBean()
方法。誰も説明できますか?
Markovitz:
これを見てURL https://spring.io/guides/topicals/spring-security-architecture/ここは@BeanとしてあなたがAutowire AuthenticationManagerBuilder払いと思われます。
設定(AuthenticationManagerBuilder AUTH)には、このケースで動作し、passwordEncoderもAutowiredですので。