我正在使用 Spring Batch 2.1.6.RELEASE 开始一个新项目,我使用 Maven 进行依赖管理。
默认情况下,它导入 spring 框架 2.5.6,但我想改用 3.0.5.RELEASE。
This post说它是兼容的,但我不知道如何在我的 maven pom 文件中声明它。
我尝试只放置 spring-core、spring-beans 和 spring-context 版本 3.0.5.RELEASE 的依赖项,但这会在不删除 2.5.6 版本的情况下将库添加到项目中。
我查看了 spring-batch-parent pom 文件,有一个名为“spring3”的配置文件使用了我想要的 spring 版本。如何激活项目的 pom 文件中的配置文件?
提前致谢
菲利普
最佳答案
可以通过依赖exclusions来排除Spring Batch对Spring Framework v2.5.6的瞬时依赖。 maven 中 spring-batch 依赖项的元素。像...
<dependency>
<groupId>org.springframework.batch</groupId>
<artifactId>spring-batch-core</artifactId>
<version>2.1.6.RELEASE</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</exclusion>
<!-- Other exclusions here -->
</exclusions>
</dependency>
关于java - 如何在 Spring Batch 中覆盖 spring 框架版本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4945187/