Maven : Spring 4 + Spring Security

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20821155/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 06:25:56  来源:igfitidea点击:

Maven : Spring 4 + Spring Security

springmavenspring-mvcspring-securityspring-4

提问by aleh

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 :)

您能向我解释一下如何使用 Spring 正确构建 Web 应用程序吗?我知道 Spring 框架的最新版本是 4.0.0.RELEASE,但 Spring Security 的最新版本是 3.2.0.RELEASE,它依赖于 spring 3.2.6...也许我错了:)

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

如何将其与 Maven 集成?我可以使用 Spring 4 还是必须使用以前的版本?什么是正确的方法?

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

如果对你来说不难,你能告诉我你的 pom.xml 吗?

回答by Vidya

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

使用 Spring 4 应该没问题。如文档中所述:

"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."

Spring Security 针对 Spring Framework 3.2.6.RELEASE 构建,但也针对 Spring Framework 4.0.0.RELEASE 进行了测试。这意味着您可以将 Spring Security 3.2.0.RELEASE 与 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:

他们继续描述在您的项目中将 Spring 4 与 Spring Security 集成的策略。像这个:

<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>