我是Spring Boot的新手,正在尝试实现从该链接中学到的一切:login-registration-feature。我的目标是建立用户登录和注册功能,但是我遇到了以下错误:
***************************
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.
我的文件夹结构和代码与链接中提到的相同。但无法弄清楚为什么@AutoWired无法正常工作。请帮我。谢谢。
在配置类中WebSecurityConfig
直接添加bean:
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句