java - Is @Autowired required on configureGlobal(..) when using @EnableWebSecurity? -
in example there @autowired annotation on configureglobal method:
@enablewebsecurity public class multihttpsecurityconfig { @autowired public void configureglobal(authenticationmanagerbuilder auth) { auth .inmemoryauthentication() .withuser("user").password("password").roles("user").and() .withuser("admin").password("password").roles("user", "admin"); } is necessary or spring automatically inject authenticationbuilder on methods annotated @enablewebsecurity??
the code snippet pulled when-to-use-spring-securitys-antmatcher
according spring documentation @enablewebsecurity annotation switches off default web application security configuration in order let add custom features configureglobal.
configureglobal should @autowired in order authenticationmanagerbuilder bean , define authentication type application.
in conclusion @enablewebsecurity doesn't inject beans, provides way customize web security application.
Comments
Post a Comment