代码语言:javascript复制
<security:authentication-manageralias="authenticationManager" >
<security:authentication-provider user-service-ref="userservice1">
<security:password-encoder ref="passwordEncoder"/>
</security:authentication-provider>
</security:authentication-manager>
自从Spring Security 3.0以后,我们需要声明类似上面的配置来注册AuthenticationManager类,该类负责提供授权服务,比如上面的userservice1,如果我们想在java程序中获取authenticationManager对象,可以使用applicationContext.getBean("authenticationManager")方法获得,这里alias属性功能类似id属性