[英]Spring security issue with Http tag
My spring configuration file is as follows 我的spring配置文件如下
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xmlns:security="http://www.springframework.org/schema/security"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/data/jpa
http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security.xsd
">
<http auto-config="true">
<security:intercept-url pattern="/admin**" access="ROLE_USER" />
</http>
<authentication-manager>
<authentication-provider>
<user-service>
<user name="test" password="test" authorities="ROLE_USER" />
</user-service>
</authentication-provider>
</authentication-manager>
</beans>
However I have encountered the following error 但是我遇到了以下错误
cvc-complex-type.2.4.a: Invalid content was found starting with element 'http'. One of '{"http://www.springframework.org/schema/beans":import, "http://www.springframework.org/schema/beans":alias, "http://
www.springframework.org/schema/beans":bean, WC[##other:"http://www.springframework.org/schema/beans"], "http://www.springframework.org/schema/beans":beans}' is expected.
What could possibly be wrong? 有什么可能是错的吗? The error cross mark as shown by Eclipse is right where http tag starts.
Eclipse所示的错误十字标记正好位于http标记开始的位置。
UPDATE I am using gradle and my build.gradle file has following dependencies for Spring: 更新我正在使用gradle并且我的build.gradle文件具有以下Spring依赖项:
compile 'org.slf4j:slf4j-api:1.7.12'
compile 'com.googlecode.json-simple:json-simple:1.1.1'
compile 'de.grundid.opendatalab:geojson-jackson:1.0'
compile 'org.springframework:spring-web:4.2.5.RELEASE'
compile 'org.springframework:spring-webmvc:4.2.5.RELEASE'
compile 'org.springframework:spring-jdbc:4.2.5.RELEASE'
compile 'org.springframework:spring-core:4.2.5.RELEASE'
compile 'org.springframework:spring-context:4.2.5.RELEASE'
compile 'org.springframework:spring-aop:4.2.5.RELEASE'
compile 'org.springframework.security:spring-security-web:4+'
compile 'org.springframework.security:spring-security-config:4+'
The following Spring dependencies are in my project's build path: 以下Spring依赖项在我的项目的构建路径中:
Your XML document has the Spring beans namespace as default namespace. 您的XML文档将Spring bean名称空间作为默认名称空间。 The
http
element and the other elements from Spring Security are in the security namespace. Spring Security中的
http
元素和其他元素位于安全名称空间中。 You need to prefix: 您需要添加前缀:
<security:http auto-config="true">
<security:intercept-url pattern="/admin**" access="ROLE_USER" />
</security:http>
<security:authentication-manager>
<security:authentication-provider>
<security:user-service>
<security:user name="test" password="test" authorities="ROLE_USER" />
</security:user-service>
</security:authentication-provider>
</security:authentication-manager>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.