在启动springboot项目时,提示AuthenticationManager无法注入问题
报如下错误:
Description:
Field authenticationManager in com.security.uaa.config.AuthorizationServer required a bean of type 'org.springframework.security.authentication.AuthenticationManager' that could not be found.
The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)
解决方法:
在继承 WebSecurityConfigurerAdapter 的类中配置
代码:
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}