Пожалуйста, сообщите, где я здесь не так. @Component и @Qualifier не работают. Получение такого исключенного компонента.@ Компонент аннотация не работает
У меня есть пружинный XML безопасности, часть, которая следует
<http use-expressions="true" create-session="stateless" >
<form-login login-page="/inventory/auth/login"
always-use-default-target="true" default-target-url="/inventory/secureauth"
authentication-failure-url="/inventory/secureauth/login?login_error=1"
username-parameter="username" password-parameter="password" />
<custom-filter position="PRE_AUTH_FILTER" ref="cookieSessionFilter" />
</http>
<authentication-manager alias="authenticationManager">
<authentication-provider ref="userAuthenticationProvider" />
</authentication-manager>
Я написал AbstractPreAuthenticatedProcessingFilter следующего
package com.eim.security;
@Component(value="cookieSessionFilter")
public class CookieSessionFilter extends AbstractPreAuthenticatedProcessingFilter {
@Autowired
public CookieSessionFilter(@Qualifier(value="authenticationManager") AuthenticationManager authenticationManager) {
setAuthenticationManager(authenticationManager);
}
Пожалуйста найти мою весну диспетчер сервлет XML
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:cache="http://www.springframework.org/schema/cache"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:util="http://www.springframework.org/schema/util"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/cache
http://www.springframework.org/schema/cache/spring-cache.xsd">
<context:annotation-config />
<mvc:annotation-driven />
<context:component-scan
base-package="com.eim.security, com.eim.glossary.controller">
</context:component-scan>
Я получаю следующее исключение
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.filterChains': Cannot resolve reference to bean 'org.springframework.security.web.DefaultSecurityFilterChain#9' while setting bean property 'sourceList' with key [9]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.web.DefaultSecurityFilterChain#9': Cannot resolve reference to bean 'cookieSessionFilter' while setting constructor argument with key [2]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'cookieSessionFilter' is defined
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359)
Не знаю, почему я получаю ниже исключение, как я дал базовый-пакет для компонента сканирования в пружинном контейнере
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'cookieSessionFilter'
Пожалуйста, посоветуйте пожалуйста
Spring Security обнаруживает компоненты в корневом контексте (загружается с помощью ContextLoaderListener), ваши компоненты загружаются 'DispatcherServlet'. Переместите обнаружение компонента (или объявите его явно) в корневом контексте. –
Спасибо за советы. Переместить обнаружение компонента в корневом контексте означает? Вы хотите обновить в web.xml? Не могли бы вы посоветовать мне пример? –