hua*_*n68 1 spring spring-security
我试图将Spring安全性集成到我现有的项目中.我使用的工具是:
在Spring配置中,我有这个:
<beans:beans xmlns="http://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.1.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="/messagePost.htm*" access="ROLE_USER"/>
</http>
<authentication-provider>
<user-service>
<user name="user1" password="1111" authorities="ROLE_USER"/>
</user-service>
</authentication-provider>
</beans:beans>
Run Code Online (Sandbox Code Playgroud)
但是这个弹簧配置有一个错误:
我可以知道如何解决这个问题吗?
MaKe这些变化
<?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-3.1.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="/messagePost.htm*" access="ROLE_USER"/>
</http>
<authentication-manager>
<authentication-provider>
<user-service>
<user name="user1" password="1111" authorities="ROLE_USER"/>
</user-service>
</authentication-provider>
</authentication-manager>
</beans:beans>
Run Code Online (Sandbox Code Playgroud)
我做了以下更改
"http://springframework.org/schema/security"
为"http://www.springframework.org/schema/security"
(添加了www:D)<authentication-provider>
命名空间包含在命名<authentication-manager>
空间中. 归档时间: |
|
查看次数: |
5430 次 |
最近记录: |