首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >spring-security xml配置

spring-security xml配置
EN

Stack Overflow用户
提问于 2018-06-07 10:06:17
回答 2查看 28关注 0票数 0

我有以下spring-security.xml

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8"?>
<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-4.0.xsd
    http://www.springframework.org/schema/security/spring-security-4.2.xsd">

    <http>
        <intercept-url pattern="/course*" access="ROLE_USER"/>
    </http>

    <authentication-manager>
        <authentication-provider>
            <user-service>
                <user name="testuser" password="testpw" authorities="ROLE_USER"/>
            </user-service>
        </authentication-provider>
    </authentication-manager>


</beans:beans>

当我启动tomcat时,我得到以下错误:

代码语言:javascript
复制
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 8 in XML document from ServletContext resource [/WEB-INF/spring-security.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 8; columnNumber: 78; cvc-elt.1: Cannot find the declaration of element 'beans:beans'.

我尝试了几种不同的schemaLocation包含/排除组合。有人能看到我可能遗漏了什么吗?

EN

回答 2

Stack Overflow用户

发布于 2018-06-07 10:15:37

您应该使用b:beans而不是beans:beans

票数 0
EN

Stack Overflow用户

发布于 2018-06-07 10:17:10

试一试

代码语言:javascript
复制
<beans  xmlns="http://www.springframework.org/schema/beans"
        xmlns:util="http://www.springframework.org/schema/util"
        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-4.1.xsd
            http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.1.xsd">

<!-- Other configuration -->

</beans>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50732007

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档