spring 包的依赖问题

spring-boot-starter-parent

一般引用的时候都是parent标签 spring-boot-starter-parent继承各种依赖,添加各种starter

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.4.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

spring-boot-dependencies

有时候不需要继承parent父标签,怎么解决依赖呢
可以通过spring-boot-dependencies配置scope=import,type=pom依赖项来保持依赖项管理,但是这种方式只能在dependencyManagement标签中使用
案例如下

<dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>2.0.9.RELEASE</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>io.spring.platform</groupId>
                <artifactId>platform-bom</artifactId>
                <version>Cairo-SR8</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

可以看看 spring-boot-dependencies 包中 pom 内容,会发现 各种依赖,配置插件,都已经默认配置好了
platform-bom 在后面有介绍

其他依赖 spring-cloud-dependencies

<dependencyManagement>
<dependencies>
			<dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>Finchley.SR3</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
</dependencies>
</dependencyManagement>

其他依赖 spring-cloud-alibaba-dependencies

https://github.com/spring-cloud-incubator/spring-cloud-alibaba
依托 Spring Cloud Alibaba,您只需要添加一些注解和少量配置,就可以将 Spring Cloud 应用接入阿里微服务解决方案,通过阿里中间件来迅速搭建分布式应用系统。

<dependencyManagement>
<dependencies>
			<dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-alibaba-dependencies</artifactId>
                <version>0.2.1.RELEASE</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
</dependencies>
</dependencyManagement>

中文说明
https://github.com/spring-cloud-incubator/spring-cloud-alibaba/blob/master/README-zh.md

组件

Sentinel:把流量作为切入点,从流量控制、熔断降级、系统负载保护等多个维度保护服务的稳定性。

Nacos:一个更易于构建云原生应用的动态服务发现、配置管理和服务管理平台。

RocketMQ:一款开源的分布式消息系统,基于高可用分布式集群技术,提供低延时的、高可靠的消息发布与订阅服务。

Dubbo:Apache Dubbo™ (incubating) 是一款高性能 Java RPC 框架。

Seata:阿里巴巴开源产品,一个易于使用的高性能微服务分布式事务解决方案。

Alibaba Cloud ACM:一款在分布式架构环境中对应用配置进行集中管理和推送的应用配置中心产品。

Alibaba Cloud OSS: 阿里云对象存储服务(Object Storage Service,简称 OSS),是阿里云提供的海量、安全、低成本、高可靠的云存储服务。您可以在任何应用、任何时间、任何地点存储和访问任意类型的数据。

Alibaba Cloud SchedulerX: 阿里中间件团队开发的一款分布式任务调度产品,提供秒级、精准、高可靠、高可用的定时(基于 Cron 表达式)任务调度服务。

Alibaba Cloud SMS: 覆盖全球的短信服务,友好、高效、智能的互联化通讯能力,帮助企业迅速搭建客户触达通道。

更多组件请参考 Roadmap。

platform-bom

Spring IO Platform只是一个pom文件,记录了spring与其他开源项目对应的版本。省去了版本号,也就省去了处理依赖时的问题,因为Spring IO Platform中有最优的版本配置。

当然SpringSource为了解决这些Jar冲突,推出了各种BOM,当然最著名的就是spring platform io bom,其中最核心的三个是:spring-framework-bomspring-boot-dependenciesplatform-bom
对于Spring工程来说,直接在pom.xml文件中添加配置代码(可以看 spring-boot-dependencies 中的配置代码),即可免去管理版本冲突的难题。

<dependencyManagement>
        <dependencies>
			<dependency>
                <groupId>io.spring.platform</groupId>
                <artifactId>platform-bom</artifactId>
                <version>Cairo-SR8</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

其他依赖 spring-framework-bom

<dependencyManagement>
        <dependencies>
            <!-- https://mvnrepository.com/artifact/org.springframework/spring-framework-bom -->
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-framework-bom</artifactId>
    <version>5.1.7.RELEASE</version>
    <type>pom</type>
</dependency>
        </dependencies>
    </dependencyManagement>

其他依赖 spring-security-bom

<dependencyManagement>
        <dependencies>
<!-- https://mvnrepository.com/artifact/org.springframework.security/spring-security-bom -->
<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-bom</artifactId>
    <version>5.1.5.RELEASE</version>
    <type>pom</type>
</dependency>
        </dependencies>
    </dependencyManagement>

springboot和springcloud 对应版本

查看该链接
https://start.spring.io/actuator/info

来源
https://blog.csdn.net/itboymvc/article/details/86674394
https://blog.csdn.net/weixin_33874713/article/details/86828986
https://blog.csdn.net/panchang199266/article/details/84026199
https://www.cnblogs.com/chenliyang/p/6542867.html
https://www.cnblogs.com/liaojie970/p/8973043.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

风.foxwho

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值