Spring“需要别名”

发布于 2024-11-23 19:33:41 字数 2508 浏览 1 评论 0原文

我是 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]

The 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>

I'm using spring-flex 1.5.0spring-security 2.0.6Spring 3.0

有什么想法吗?

提前致谢, 安德烈

I'm new in Spring and I'm trying to create a application using Spring Blazeds Integration (Flex + Blazeds + Spring + Java) and when I run the application I got this error:

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]

The 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>

I'm using spring-flex 1.5.0, spring-security 2.0.6 and Spring 3.0.

Any ideas what is the problem?

Thanks in advance,
Andre

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

彡翼 2024-11-30 19:33:41

我不太确定,但尝试在 security:authentication-manager 中添加一个别名:

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

为什么不使用 Spring security 3?

I'm not very sure, but try to put an alias in security:authentication-manager:

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

Why don't you use Spring security 3?

┊风居住的梦幻卍 2024-11-30 19:33:41

参考中列出的手册,Spring Flex 1.5.0 无法与 Spring Security 2 一起使用。您必须使用 Spring Security 3。

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

As listed in the reference manual, Spring Flex 1.5.0 will not work with Spring Security 2. You must use Spring Security 3.

Other than this, jbbarquero is correct, assuming this is actually your problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文