Spring 4.1.7和spring security 4.0.1 Spring Beans问题

时间:2015-07-23 06:28:53

标签: java xml spring spring-mvc spring-security

我正在尝试开发一个使用最新版本的spring framework-4.1.7和spring security version 4.0.1的Web项目。

我遇到的问题是spring security xml文件中的命名空间spring bean问题

春豆问题

  1. 配置问题:您无法在Spring Security 3.2中使用spring-security-2.0.xsd或spring-security-3.0.xsd或spring-security-3.1.xsd架构。请将架构声明更新为3.2架构。
  2. 您不能在Spring Security 3.2中使用spring-security-2.0.xsd或spring-security-3.0.xsd或spring-security-3.1.xsd架构。请将您的架构声明更新为3.2架构。 spring-security.xml
  3. 我的pom.xml

     <dependencyManagement>
        <dependencies>
          <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-framework-bom</artifactId>
            <version>4.1.7.RELEASE</version>
            <type>pom</type>
            <scope>import</scope>
          </dependency>
        </dependencies>
    </dependencyManagement>
      <dependencies>
    
        <!-- Spring Security -->
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>4.0.1.RELEASE</version>
        </dependency>
    
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>4.0.1.RELEASE</version>
        </dependency>
        <!-- End spring Security -->
    

    弹簧security.xml文件

    <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.0.xsd
               http://www.springframework.org/schema/security
               http://www.springframework.org/schema/security/spring-security.xsd">
        <http>
            <intercept-url pattern="/**" access="ROLE_USER" />
            <openid-login />
        </http>
        <authentication-manager>
            <authentication-provider>
                <user-service>
                    <user name="jimi" password="jimispassword" authorities="ROLE_USER, ROLE_ADMIN" />
                    <user name="bob" password="bobspassword" authorities="ROLE_USER" />
                </user-service>
            </authentication-provider>
        </authentication-manager>
    </beans:beans>
    

    冲突发生在哪里?我应该使用什么样的bean配置来保证弹簧安全。上面的pom文件依赖和spring安全版本是否冲突?谁能建议

0 个答案:

没有答案