修复Springbean配置文件中的http标记
我的bean配置文件如下修复Springbean配置文件中的http标记,spring,spring-security,spring-security-ldap,Spring,Spring Security,Spring Security Ldap,我的bean配置文件如下 <?xml version="1.0" encoding="UTF-8"?> <beans:beans xmlns="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:context=
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
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/context/spring-context.xsd
">
</beans:beans>
虽然我已经导入了security3.1.1jar,但我无法将以下内容添加到其中
<http>
<intercept-url pattern='/home*' access='ROLE_USER,ROLE_ADMIN' />
</http>
您可能需要使用
安全性
名称空间。另一种选择是将security
设为默认名称空间-您必须决定是否要这样做
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
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/security http://www.springframework.org/schema/security/spring-security.xsd">
<security:http>
<security:intercept-url pattern='/home*' access='ROLE_USER,ROLE_ADMIN'/>
</security:http>
</beans:beans>
我不仅在您使用的标记前面添加了
security:
,还在顶部添加了xmlns:security及其模式位置。谢谢。但是一个警告刚刚出现。找不到元素安全性的Spring命名空间处理程序:Http请解释:您使用的是什么IDE?您是在编写servlet还是自己的可运行jar?请显示用于运行所有操作的代码。通过在每个子标记的开头添加security:
作为security:logout