简体   繁体   English

service.SecurityServiceImpl 中的字段 authenticationManager 需要类型为“org.springframework.security.authentication.AuthenticationManager”的 bean

[英]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.

相关问题 *** 中的字段 authenticationManager 需要一个找不到的 'org.springframework.security.authentication.AuthenticationManager' 类型的 bean - Field authenticationManager in *** required a bean of type 'org.springframework.security.authentication.AuthenticationManager' that could not be found 需要一个 org.springframework.security.authentication.AuthenticationManager 类型的 bean - required a bean of type org.springframework.security.authentication.AuthenticationManager 无法自动装配字段:私有 org.springframework.security.authentication.AuthenticationManager - Could not autowire field: private org.springframework.security.authentication.AuthenticationManager Spring安全性:期望只为类型接口org.springframework.security.authentication.AuthenticationManager找到一个bean。 - Spring security : Expecting to only find a single bean for type interface org.springframework.security.authentication.AuthenticationManager java.lang.NoClassDefFoundError:org / springframework / security / authentication / AuthenticationManager - java.lang.NoClassDefFoundError: org/springframework/security/authentication/AuthenticationManager Spring需要一个'AuthenticationManager'类型的bean - Spring required a bean of type 'AuthenticationManager' 字段 authenticationManager LoginController 需要一个无法找到的 typeAuthenticationManager' bean - Field authenticationManager LoginController required a bean of typeAuthenticationManager' that could not be found 带有xml config的Spring安全性NoSuchBeanDefenitionException否AuthenticationManager类型的合格Bean - Spring security with xml config NoSuchBeanDefenitionException No Qualifying bean of type AuthenticationManager 没有类型为'org.springframework.security.authentication.AuthenticationProvider'的合格Bean - No qualifying bean of type 'org.springframework.security.authentication.AuthenticationProvider' Spring 安全认证管理器 - Spring Security AuthenticationManager
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM