Spring MVC 3,applicationContext.xml

时间:2011-04-18 08:08:13

标签: spring spring-mvc spring-security

以下配置文件有什么问题。它的applicationContex.xml给出了一个syntext错误。

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:security="http://www.springframework.org/schema/security"
  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.0.xsd
          http://www.springframework.org/schema/security
          http://www.springframework.org/schema/security/spring-security-3.1.xsd">

        <security:http auto-config='true'>
            <security:intercept-url pattern="/**" access="ROLE_USER" />
        </security:http>
  </beans>

我已经添加了spring-security-config-3.1.0.RC1.jar和spring-security-web-3.1.0.RC1.jar我缺少的任何内容?

1 个答案:

答案 0 :(得分:3)

您需要在<http><intercept-url>标记前加上安全名称空间:

<security:http auto-config='true'>
    <security:intercept-url pattern="/**" access="ROLE_USER" />
</security:http>