如何在Spring Security 3.1中正确配置http标签?

woy*_*aru 5 spring-mvc spring-security maven

我的spring-security.xml文件有问题.我想配置一些会话设置,首先创建登录表单以维护访客和登录用户.

这是我的spring-security.xml头条新闻:

<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">
Run Code Online (Sandbox Code Playgroud)

如您所见,我在最新版本3.1中使用Spring Security.当我尝试将架构版本更改为更低版本时,我遇到了错误.就3.1版本而言,我在Eclipse中只有黄色警告.

我的http标签看起来像:

<security:http auto-config='true'>      
    <security:intercept-url pattern="/wellcome*" access="ROLE_USER"  />
    <security:form-login login-page="/login" default-target-url="/wellcome" authentication-failure-url="/loginfailed"  />
    <security:logout logout-success-url="/logout" />
    <security:session-management invalid-session-url="/invalidsession" />
</security:http>
Run Code Online (Sandbox Code Playgroud)

在这个标签的第一行,我有很长的警告列表:

Multiple annotations found at this line:
- Method 'setAuthenticationEntryPoint' is marked deprecated [config set: SpringMVC/web-context]
- Method 'setSessionAuthenticationStrategy' is marked deprecated [config set: SpringMVC/web-
 context]
- Method 'setUserAttribute' is marked deprecated [config set: SpringMVC/web-context]
- Method 'setRequestCache' is marked deprecated [config set: SpringMVC/web-context]
- Method 'setKey' is marked deprecated [config set: SpringMVC/web-context]
- Method 'setSecurityContextRepository' is marked deprecated [config set: SpringMVC/web-context]
Run Code Online (Sandbox Code Playgroud)

另外我在第三行还有一个警告:

Method 'setLoginFormUrl' is marked deprecated [config set: SpringMVC/web-context]
Run Code Online (Sandbox Code Playgroud)

你能解释一下我在Spring Security 3.1中如何正确定义spring-security.xml带有http标签的文件吗?

Xae*_*ess 6

编辑:此问题现已在Spring Security 3.1.2中修复,因此如果您使用的是3.1或3.1.1,请将其升级到更新版本.

原始答案:

你的配置很好.这是Spring Security中一个已知错误,在Eclipse中使用STS(参见参考URL中提到的论坛主题).

现在你可以忽略这些警告,登录https://jira.springsource.org并对问题进行投票并等到它被修复(或者如果你不能忍受这些警告,则删除项目的弹簧特性).