Maven : Spring 4 + Spring Security

2019-02-05 16:21发布

问题:

Can you explain to me how to properly build a web app with Spring? I know that the latest version of Spring framework is 4.0.0.RELEASE, but the latest version of Spring Security is 3.2.0.RELEASE, and it depends on spring 3.2.6... maybe i'm wrong :)

How can I integrate it with Maven? Can I use Spring 4 or must I use the previous version? What is the proper way?

If it`s not hard for you could you show me you pom.xml?

回答1:

You should be fine using Spring 4. As described in the documentation:

"Spring Security builds against Spring Framework 3.2.6.RELEASE, but is also tested against Spring Framework 4.0.0.RELEASE. This means you can use Spring Security 3.2.0.RELEASE with Spring Framework 4.0.0.RELEASE."

They go on to describe strategies for integrating Spring 4 with Spring Security in your project. Like this one:

<dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-framework-bom</artifactId>
        <version>4.0.0.RELEASE</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
</dependencyManagement>