spring bom的正确使用方式?

https://howtodoinjava.com/mav...,是引用完zhihou可以不用指定版本号,所以是

<dependencyManagement>

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

</dependencies>

等价于

<dependencies>

 <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>4.3.7.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>4.3.7.RELEASE</version>
    </dependency> 

</dependencies>

的意思吗?如果只是这样,看起来没什么用啊

守着一只汪
浏览 441回答 2
2回答

胡说叔叔

你这都是spring体系都 所以版本都是一样的 所以你看上去没什么用其实他还指定了大量的第三方的非spring体系的项目的版本 确保不会有版本不匹配的问题 这个才是最实用的

慕田峪7331174

spring的bom貌似只制定了自家东西的版本,用处有限 带第三方依赖版本的是Spring IO Platform,但是官网上写着推荐继承spring-boot-starter-parent或者用spring-boot-dependencies 其实好处就是很多依赖都不需要写版本,需要升级或者降级的话只升级bom(或者父项目)就可以了
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java