spring bom 解决spring依赖多版本问题
来源:互联网 发布:淘宝假单号哪里买 编辑:程序博客网 时间:2024/05/04 23:06
Maven "Bill Of Materials" Dependency
It is possible to accidentally mix different versions of Spring JARs when using Maven. For example,
you may find that a third-party library, or another Spring project, pulls in a transitive dependency to an
older release. If you forget to explicitly declare a direct dependency yourself, all sorts of unexpected
issues can arise.
To overcome such problems Maven supports the concept of a "bill of materials" (BOM) dependency.
You can import the spring-framework-bom in your dependencyManagement section to ensure
that all spring dependencies (both direct and transitive) are at the same version.
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>4.3.1.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
An added benefit of using the BOM is that you no longer need to specify the <version> attribute when
depending on Spring Framework artifacts:
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
It is possible to accidentally mix different versions of Spring JARs when using Maven. For example,
you may find that a third-party library, or another Spring project, pulls in a transitive dependency to an
older release. If you forget to explicitly declare a direct dependency yourself, all sorts of unexpected
issues can arise.
To overcome such problems Maven supports the concept of a "bill of materials" (BOM) dependency.
You can import the spring-framework-bom in your dependencyManagement section to ensure
that all spring dependencies (both direct and transitive) are at the same version.
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>4.3.1.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
An added benefit of using the BOM is that you no longer need to specify the <version> attribute when
depending on Spring Framework artifacts:
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependencies>
上面配置完成后 多个第三方jar依赖的spring版本就可以统一起来,并且 你也不用再申明spring依赖的版本了
1 0
- spring bom 解决spring依赖多版本问题
- spring bom 解决spring依赖多版本问题
- Spring学习总结(22)——Spring-framework-bom解决spring的不同模块依赖版本不同问题
- Spring相关的BOM,有效解决不同模块依赖版本问题
- 解决jar包依赖:Spring IO platform推出bom
- 解决jar包依赖:Spring IO platform推出bom
- 解决jar包依赖:Spring IO platform推出bom
- J2ee项目从0搭建(五):最新Spring下载(BOM解决jar包依赖)、集成
- spring maven项目解决依赖jar包版本冲突方案
- spring循环依赖问题
- spring 源码探索--单例bean解决循环依赖问题
- spring boot解决第三方jar包依赖的问题
- 解决WebSocket无法依赖注入的问题(Spring)
- spring boot解决第三方jar包依赖的问题
- Spring如何解决循环依赖
- Spring如何解决循环依赖
- Spring如何解决循环依赖
- Spring中的循环依赖问题
- 经典递归汉诺塔
- Tween 补间动画
- TextView相关
- 为什么要用实现接口的类实例化接口呢
- 接口和自定义观察者模式
- spring bom 解决spring依赖多版本问题
- IOS中 UIFont 字体大全
- 工厂模式
- VMware Ubuntu虚拟机linux内核版本从2.6.22升级到3.6.0-rc7
- android之官方下拉刷新组件SwipeRefreshLayout
- Java随记
- CodeForces 373C Counting Kangaroos is Fun(袋鼠藏口袋,二分)
- 【数组7】把数组排成最小的数
- 努力就可以上清华北大吗?(转载)