Maven Spring BOM (bill of materials)

来源:互联网 发布:优芽微课制作软件 编辑:程序博客网 时间:2024/05/15 23:52

为了防止用Maven管理Spring项目时,不同的项目依赖了不同版本的Spring,可以使用Maven BOM来解决者一问题。

在依赖管理时,引入spring-framework-bom,如:

复制代码
<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>
复制代码

即可统一版本,而且,在引入BOM之后,在引入其他Spring依赖时,都无需指定版本,如:

复制代码
<dependencies>    <dependency>        <groupId>org.springframework</groupId>        <artifactId>spring-context</artifactId>    </dependency>    <dependency>        <groupId>org.springframework</groupId>        <artifactId>spring-web</artifactId>    </dependency><dependencies>
原创粉丝点击