Spring“别名是必需的”

时间:2011-07-14 06:09:47

标签: spring spring-security alias

我是Spring的新手,我正在尝试使用Spring Blazeds Integration(Flex + Blazeds + Spring + Java)创建应用程序,当我运行应用程序时出现此错误:

02:51:21,852 INFO  [XmlBeanDefinitionReader] Loading XML bean definitions from ServletContext resource [/WEB-INF/spring/security-config.xml]
02:51:23,937 ERROR [ContextLoader] Context initialization failed
    org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: alias is required.
    Offending resource: ServletContext resource [/WEB-INF/spring/security-config.xml]

security-config.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns:security="http://www.springframework.org/schema/security"
    xmlns:beans="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                        http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd">

    <security:http>
        <security:anonymous enabled="false" />
        <security:form-login default-target-url="/myContext/Index.html"
            login-page="/myContext/Login.html" />
        <security:remember-me key="myAppKey" services-ref="rememberMeServices" />
    </security:http>

    <beans:bean id="rememberMeServices"
        class="org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices">
        <beans:property name="key" value="myAppKey" />
        <beans:property name="alwaysRemember" value="true" />
    </beans:bean>

    <security:authentication-manager>
        <security:authentication-provider>
            <security:user-service>
                <security:user name="john" password="john" authorities="ROLE_USER" />
                <security:user name="admin" password="admin" authorities="ROLE_USER, ROLE_ADMIN" />
                <security:user name="guest" password="guest" authorities="ROLE_GUEST" />
            </security:user-service>
        </security:authentication-provider>
    </security:authentication-manager>

</beans:beans>

我正在使用 spring-flex 1.5.0 spring-security 2.0.6 Spring 3.0

任何想法是什么问题?

提前致谢, 安德烈

2 个答案:

答案 0 :(得分:1)

我不太确定,但尝试在 安全性中添加别名:authentication-manager

<security:authentication-manager alias="authenticationManager">

为什么不使用Spring security 3?

答案 1 :(得分:0)

reference manual中所列,Spring Flex 1.5.0不适用于Spring Security 2.您必须使用Spring Security 3.

除此之外,jbbarquero是正确的,假设这实际上是你的问题。