0
我是Spring安全新手,我试图将它应用到一个可用的spring-mvc项目中。 错误是:如何正确编写spring-security.xml文件?
cvc-complex-type.2.4.c: The matching wildcard is strict,
but no declaration can be found for element http.
弹簧security.xml文件:在pom.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"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security.xsd
http://www.springframework.org/schema/context/spring-context.xsd">
<http auto-config='true'>
<intercept-url pattern="/**" access="ROLE_USER" />
</http>
<authentication-manager>
<authentication-provider>
<user-service>
<user name="matt3o" password="secret" authorities="ROLE_USER" />
<user name="admin" password="admin" authorities="ROLE_USER,ROLE_ADMIN" />
</user-service>
</authentication-provider>
我加入了弹簧安全的依赖。
如果我删除
<http auto-config='true'>
<intercept-url pattern="/**" access="ROLE_USER" />
</http>
的错误是一样的,但是:
no declaration can be found for element authentication-manager.
它看起来像命名空间不工作。
好的。谢谢。我是否还需要对“http”行进行一些配置? – MdC
更新了我的答案。 –
匹配的通配符是严格的,但是对于元素http没有声明。似乎第一个问题就解决了。 – MdC