[英]Field authenticationManager in service.SecurityServiceImpl required a bean of type 'org.springframework.security.authentication.AuthenticationManager'
I am new to Spring Boot and trying to implement whatever I've learned from this link: login-registration-feature .我是 Spring Boot 的新手,正在尝试实施我从这个链接学到的一切: 登录注册功能。 My aim is to build a user login and registration feature but i'm stuck with this error:我的目标是建立一个用户登录和注册功能,但我遇到了这个错误:
***************************
APPLICATION FAILED TO START
***************************
Description:
Field authenticationManager in com.x.assignment.auth.service.SecurityServiceImpl 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)
Action:
Consider defining a bean of type 'org.springframework.security.authentication.AuthenticationManager' in your configuration.
My folder structure, code is same as the one mentioned in the link.我的文件夹结构,代码与链接中提到的相同。 But couldn't figure out why @AutoWired is not working.但无法弄清楚为什么 @AutoWired 不起作用。 Please help me.请帮我。 Thank you.谢谢你。
In the configuration class WebSecurityConfig
add bean directly:在配置 class WebSecurityConfig
直接添加bean:
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.