1

我找到了一些解决方案,但它们对我不起作用。我将库添加到项目中,但出现此错误。我可以从我的控制器类访问安全库。任何想法?

org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration     problem: Unable to locate Spring NamespaceHandler for XML schema namespace     [http://www.springframework.org/schema/security] 
Offending resource: ServletContext resource [/WEB-INF/spring-security.xml]

这是我的 spring-security.xml

<beans:beans xmlns="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.1.xsd">

<http auto-config="true">
    <intercept-url pattern="/*" access="ROLE_USER" />
</http>

<authentication-manager>
  <authentication-provider>
    <user-service>
    <user name="test" password="123" authorities="ROLE_USER" />
    </user-service>
  </authentication-provider>
</authentication-manager>

</beans:beans>
4

2 回答 2

0

改为http://www.springframework.org/schema/security/spring-security-3.0.xsd用作您的命名空间。

于 2013-06-06T14:16:53.797 回答
0

避免

"org.xml.sax.SAXParseException: schema_reference.4: Failed to read
 schema document 'springframework.org/schema/security/…;, because 1)
 could not find the document; 2) the document could not be read; 3) the
 root element of the document is not <xsd:schema>."

更改springframework.org/schema/security/spring-security-3.1.4.xsdspringframework.org/schema/security/spring-security-3.1.xsd

于 2013-11-13T11:17:51.333 回答