Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/mercurial/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
未声明Spring安全http和身份验证提供程序_Spring_Spring Security - Fatal编程技术网

未声明Spring安全http和身份验证提供程序

未声明Spring安全http和身份验证提供程序,spring,spring-security,Spring,Spring Security,我试图将Spring安全性集成到我现有的项目中。我使用的工具有: 春季2.5.6.03 spring security core 3.1.1.1版本 jdk7 在spring配置中,我有以下内容: <beans:beans xmlns="http://springframework.org/schema/security" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://

我试图将Spring安全性集成到我现有的项目中。我使用的工具有:

  • 春季2.5.6.03
  • spring security core 3.1.1.1版本
  • jdk7
  • 在spring配置中,我有以下内容:

    <beans:beans xmlns="http://springframework.org/schema/security"
        xmlns:beans="http://www.springframework.org/schema/beans"
        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.1.xsd
                            http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd">
    
    <http auto-config='true'>
      <intercept-url pattern="/messagePost.htm*" access="ROLE_USER"/>
    </http>
    
    <authentication-provider>
      <user-service>
        <user name="user1" password="1111" authorities="ROLE_USER"/>
      </user-service>
    </authentication-provider>
    </beans:beans>
    
    
    
    但此spring配置有一个错误:

  • cvc复杂类型.2.4.c:匹配的通配符是严格的,但找不到元素“authentication provider”的声明
  • cvc复杂类型.2.4.c:匹配的通配符是严格的,但找不到元素“http”的声明
  • 我可以知道如何解决此问题吗?

    进行这些更改

    <?xml version="1.0" encoding="UTF-8"?>
    <beans:beans xmlns="http://www.springframework.org/schema/security"
    xmlns:beans="http://www.springframework.org/schema/beans"
    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.1.xsd
            http://www.springframework.org/schema/security
            http://www.springframework.org/schema/security/spring-security-3.1.xsd">
    
      <http auto-config='true'>
        <intercept-url pattern="/messagePost.htm*" access="ROLE_USER"/>
      </http>
    
      <authentication-manager>
        <authentication-provider>
          <user-service>
            <user name="user1" password="1111" authorities="ROLE_USER"/>
          </user-service>
        </authentication-provider>
      </authentication-manager>
    
    </beans:beans>
    
    
    
    我做了以下修改

  • 已从
    更改您的xmlns架构http://springframework.org/schema/security“
    ”http://www.springframework.org/schema/security“
    (新增www:D)
  • 我已将
    名称空间括在
    名称空间中
  • 做出这些改变

    <?xml version="1.0" encoding="UTF-8"?>
    <beans:beans xmlns="http://www.springframework.org/schema/security"
    xmlns:beans="http://www.springframework.org/schema/beans"
    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.1.xsd
            http://www.springframework.org/schema/security
            http://www.springframework.org/schema/security/spring-security-3.1.xsd">
    
      <http auto-config='true'>
        <intercept-url pattern="/messagePost.htm*" access="ROLE_USER"/>
      </http>
    
      <authentication-manager>
        <authentication-provider>
          <user-service>
            <user name="user1" password="1111" authorities="ROLE_USER"/>
          </user-service>
        </authentication-provider>
      </authentication-manager>
    
    </beans:beans>
    
    
    
    我做了以下修改

  • 已从
    更改您的xmlns架构http://springframework.org/schema/security“
    ”http://www.springframework.org/schema/security“
    (新增www:D)
  • 我已将
    名称空间括在
    名称空间中

  • 我可以知道
    是Spring3中的一项新功能吗?我还没有使用SpringSecurity<3。所以我不确定。您可以查看更多信息。我可以知道
    是Spring3中的一项新功能吗?我没有使用SpringSecurity<3。所以我不确定。你可以查看更多关于这个的信息。