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

标签 maven spring-mvc spring-security

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

这是我的 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">

如您所见,我使用的是最新版本的 Spring Security - 3.1。当我尝试将架构版本更改为较低时,出现错误。就 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>

在这个标签的第一行,我有一长串警告:
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]

另外我在第三行还有一个警告:
Method 'setLoginFormUrl' is marked deprecated [config set: SpringMVC/web-context]

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

最佳答案

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

原答案:

你的配置没问题。它是 a known bug in Spring Security with STS in Eclipse (另请参阅引用 URL 中提到的论坛主题)。

现在你可以忽略警告,登录 https://jira.springsource.org并对问题进行投票并等待它解决(如果您无法忍受这些警告,则删除项目的 Spring 性质)。

关于maven - 如何在 Spring Security 3.1 中正确配置 http 标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11338985/

相关文章:

java - Springframework 安全性,无法为 POST 方法提交 html 表单

java - Spring security 3.2 - @PostAuthorize 表达式根据方法的返回对象评估主体

java - Apache Avro Maven 插件生成 UUID 字段而不是字符串

java - 带有外部 jar 的 Maven 程序集

spring-mvc - Spring 和 SiteMesh 错误页面未修饰(跳过主要过滤器)

mongodb - spring data mongodb 按集合查找

grails - Grails和Spring安全性:一段时间后密码无效?

java - OIOSAML Maven 集成

java - 我无法从命令行启动 jetty,它需要 Main-Class list 属性

java - Spring MVC 中带有抽象类的 @ModelAttribute