Update Spring Security article
Removed redundant field
@@ -23,9 +23,6 @@ import org.springframework.security.web.authentication.SimpleUrlAuthenticationFa
@ComponentScan("org.baeldung.security")
public class SecurityJavaConfig extends WebSecurityConfigurerAdapter {
- @Autowired
- private PasswordEncoder encoder;
-
@Autowired
private CustomAccessDeniedHandler accessDeniedHandler;
@@ -45,9 +42,9 @@ public class SecurityJavaConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(final AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication()
- .withUser("admin").password(encoder.encode("adminPass")).roles("ADMIN")
+ .withUser("admin").password(encoder().encode("adminPass")).roles("ADMIN")
.and()
- .withUser("user").password(encoder.encode("userPass")).roles("USER");
+ .withUser("user").password(encoder().encode("userPass")).roles("USER");
}
@Override
