replace @Autowired by @Bean annotation for the authentication provider

This commit is contained in:
akuksin
2020-03-01 11:41:50 +01:00
parent 054d177ef2
commit 4f056283b3

View File

@@ -3,7 +3,6 @@ package io.reflectoring.passwordencoding.configuration;
import io.reflectoring.passwordencoding.authentication.DatabaseUserDetailPasswordService;
import io.reflectoring.passwordencoding.authentication.DatabaseUserDetailsService;
import io.reflectoring.passwordencoding.workfactor.BcCryptWorkFactorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationProvider;
@@ -72,7 +71,7 @@ class SecurityConfiguration extends WebSecurityConfigurerAdapter {
return new DelegatingPasswordEncoder(encodingId, encoders);
}
@Autowired
@Bean
public AuthenticationProvider daoAuthenticationProvider() {
DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
provider.setPasswordEncoder(passwordEncoder());