我的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"
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.2.xsd
http://www.springframework.org/schema/jdbc
http://www.springframework.org/schema/jdbc/spring-jdbc-3.2.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.2.xsd">
<beans:http auto-config="true" use-expressions="true">
<beans:intercept-url pattern="/admin**" access="hasRole('ROLE_ADMIN')" />
<beans:intercept-url pattern="/user**" access="hasRole('ROLE_USER')" /><!--
access denied page -->
<beans:access-denied-handler error-page="/403" />
<beans:form-login login-page="/login" authentication-failure-url="/login?error"
username-parameter="username" password-parameter="password" />
<beans:logout logout-success-url="/login?logout" /><!-- enable csrf protection -->
<beans:csrf />
</beans:http>
<beans:authentication-manager>
<beans:authentication-provider user-service-ref="loginService" />
</beans:authentication-manager>
这是一个错误
cvc-complex-type.2.4.a:找到以元素'beans:http'开头的无效内容。预计会有一个......(我不能发布超过2个链接)。
有什么问题?请帮忙!
答案 0 :(得分:0)
删除<beans:
<http auto-config="true" use-expressions="true">
<intercept-url pattern="/admin**" access="hasRole('ROLE_ADMIN')" />
<intercept-url pattern="/user**" access="hasRole('ROLE_USER')" /><!--
access denied page -->
<access-denied-handler error-page="/403" />
<form-login login-page="/login" authentication-failure-url="/login?error"
username-parameter="username" password-parameter="password" />
<logout logout-success-url="/login?logout" /><!-- enable csrf protection -->
<csrf />
</http>
<authentication-manager>
<authentication-provider user-service-ref="loginService" />
</authentication-manager>