使用Spring的security.xml奇怪的错误

Max*_*xiq 1 spring-security

我试图在我的简单应用程序中配置Spring Security.这是我的配置文件security.xml:

<beans:beans xmlns="http://www.springframework.org/schema/security"
    xmlns:b="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:jdbc="http://www.springframework.org/schema/jdbc"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
                        http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                        http://www.springframework.org/schema/jdbc
                        http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd
                        http://www.springframework.org/schema/security
                        http://www.springframework.org/schema/security/spring-security-3.0.xsd">
    <http>
        <form-login login-page="/login/" authentication-failure-url="/fail/" />
        <logout logout-success-url="/" />
    </http>

    <authentication-manager>
        <authentication-provider user-service-ref='myUserDetailsService' />
    </authentication-manager>

    <b:bean id="myUserDetailsService" class="my.package.security.MyUserDataService" />
</beans:beans>
Run Code Online (Sandbox Code Playgroud)

部署时出现以下错误:

元素"beans:beans"的前缀"beans"未绑定.

我该如何解决这个问题?

ska*_*man 7

你错过了beansb前缀.您已声明了b前缀,然后使用了该前缀beans.你需要选择一个并坚持下去.例如,替换

xmlns:b="http://www.springframework.org/schema/beans" 
Run Code Online (Sandbox Code Playgroud)

xmlns:beans="http://www.springframework.org/schema/beans" 
Run Code Online (Sandbox Code Playgroud)

然后

<b:bean...
Run Code Online (Sandbox Code Playgroud)

<beans:bean...
Run Code Online (Sandbox Code Playgroud)