【发布时间】:2017-11-08 17:43:59
【问题描述】:
每当我运行我的 Spring MVC 应用程序时都会遇到此错误。我一直在尝试集成 Spring Security,但未能成功注入我的自定义 AuthenticationSuccessHandler,因此出现以下与应用程序上下文有关的错误:
2017-11-07 16:05:03 ERROR ContextLoader:350 - Context initialization failed
org.springframework.beans.factory.UnsatisfiedDependencyException: \
Error creating bean with name 'webSecurityConfig': \
Unsatisfied dependency expressed through field 'auth'; \
nested exception is
org.springframework.beans.factory.NoSuchBeanDefinitionException: \
No qualifying bean of type \
'org.springframework.security.web.authentication.AuthenticationSuccessHandler' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:588)
我在 GitHub 上有我的项目:https://github.com/riveraadrian571/Staging-Management-System-Modifed-.git。我正在使用 oracle 数据库,并且在 pom.xml 文件中使用的是我在本地存储库中拥有的 jdbc 驱动程序,因此您可能想要更改它。我也在使用 tomcat 服务器来运行应用程序。提前致谢。
【问题讨论】:
-
请在问题本身中包含代码的minimal reproducible example。
标签: java spring spring-mvc