security.xml strange error using Spring

匿名 (未验证) 提交于 2019-12-03 02:34:02

问题:

I am trying to configure Spring Security in my simple application. Here is my configuration file, 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> 

I got following errors with deploying:

The prefix "beans" for element "beans:beans" is not bound.

How can I fix this problem?

回答1:

You're missing up the beans and b prefixes. You've declared the b prefix, and then used the beans one. You need to pick one and stick with it. For example, replace

xmlns:b="http://www.springframework.org/schema/beans"  

with

xmlns:beans="http://www.springframework.org/schema/beans"  

and then

<b:bean... 

with

<beans:bean... 


回答2:

You're declaring the namespace as b: and using it everywhere except the enclosing beans tag, in which you're using beans:beans instead of b:beans.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!