Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Maven 如何在SpringSecurity3.1中正确配置http标记?_Maven_Spring Mvc_Spring Security - Fatal编程技术网

Maven 如何在SpringSecurity3.1中正确配置http标记?

Maven 如何在SpringSecurity3.1中正确配置http标记?,maven,spring-mvc,spring-security,Maven,Spring Mvc,Spring Security,我的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/XMLSch

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

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]
您能解释一下我应该如何在SpringSecurity3.1中正确定义带有
http
标记的
spring security.xml文件吗?


<beans:beans xmlns:beans="http://www.springframework.org/schema/beans"
    xmlns="http://www.springframework.org/schema/security"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
    xmlns:util="http://www.springframework.org/schema/util"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd
        http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd">

<http auto-config="true" disable-url-rewriting="true" use-expressions="true"> 
        <form-login login-processing-url="/login"
            login-page="/login.html"
            default-target-url='/index.html'
            always-use-default-target='true'
/>

<logout logout-url="/logout" />

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

原始答案:

你的配置很好。它是(另请参见参考URL中提到的论坛主题)


现在,您可以忽略这些警告,登录并投票表决该问题,直到问题得到解决(或者,如果您无法忍受这些警告,请删除项目的spring nature)。

警告仍然是一样的。
<beans:beans xmlns:beans="http://www.springframework.org/schema/beans"
    xmlns="http://www.springframework.org/schema/security"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
    xmlns:util="http://www.springframework.org/schema/util"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd
        http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd">

<http auto-config="true" disable-url-rewriting="true" use-expressions="true"> 
        <form-login login-processing-url="/login"
            login-page="/login.html"
            default-target-url='/index.html'
            always-use-default-target='true'
/>

<logout logout-url="/logout" />