随着现在互联网项目在分布式、微服务上的广泛应用, SpringCloud解决方案也被越来越多的公司所使用。写这个博客主要是为了深入学习相关知识,学习过程中主要参考尚硅谷教程,如有不足之处请指正。

 SpringBoot

SpringBoot采用SpringBoot 2.0版本,git源码新特性可点击链接查看。SpringBoot官方推荐升级到2.0版本

SpringCloud简介

SpringCloud

SpringCloud源码官网 ,因为Spring Cloud不同其他独立项目,它拥有很多子项目的大项目,Spring Cloud Config,Spring Cloud Netflix,Spring Cloud Bus等,为了防止与这些子系统的版本号混淆,Spring Cloud的版本号全部使用英文单词。

版本名:是伦敦的地铁名

版本号SR(Service Releases)是固定的 ,大概意思是稳定版本。后面会有一个递增的数字。

GA:(GenerallyAvailable),表示稳定版本

所以 HoxTon.SR12就是HoxTon的第12个Release版本。

SNAPSHOT:快照版本,随时可能修改

M: MileStone,M1表示第1个里程碑版本,一般同时标注PRE,表示预览版版。

SR:Service Release,SR1表示第1个正式版本,一般同时标注

版本号后面的SRX,X代表一个数字,这个是小版本号,就是在特定的版本中,修复一些致命问题,做的升级版本号。所以它是的版本是 版本名+版本号 (如HoxTon.SR12)。

SpringCloud和SpringBoot依赖

SpringCloud和SpringBoot项目依赖使用也可以查看官方的依赖链接,会返回Json串,从上面能看到返回依赖的详细信息。

{
  "git": {
    "branch": "9f6099852d28f3626d110706391bdad6f34c4580",
    "commit": {
      "id": "9f60998",
      "time": "2021-09-29T06:11:16Z"
    }
  },
  "build": {
    "version": "0.0.1-SNAPSHOT",
    "artifact": "start-site",
    "versions": {
      "spring-boot": "2.5.5",
      "initializr": "0.11.1-SNAPSHOT"
    },
    "name": "start.spring.io website",
    "time": "2021-09-29T06:12:02.820Z",
    "group": "io.spring.start"
  },
  "bom-ranges": {
    "azure": {
      "3.2.0": "Spring Boot >=2.3.0.M1 and <2.4.0-M1",
      "3.5.0": "Spring Boot >=2.4.0.M1 and <2.5.0-M1",
      "3.6.1": "Spring Boot >=2.5.0.M1 and <2.6.0-M1"
    },
    "codecentric-spring-boot-admin": {
      "2.4.3": "Spring Boot >=2.3.0.M1 and <2.6.0-M1"
    },
    "solace-spring-boot": {
      "1.1.0": "Spring Boot >=2.3.0.M1 and <2.6.0-M1"
    },
    "solace-spring-cloud": {
      "1.1.1": "Spring Boot >=2.3.0.M1 and <2.4.0-M1",
      "2.1.0": "Spring Boot >=2.4.0.M1 and <2.6.0-M1"
    },
    "spring-cloud": {
      "Hoxton.SR12": "Spring Boot >=2.2.0.RELEASE and <2.4.0.M1",
      "2020.0.4": "Spring Boot >=2.4.0.M1 and <2.5.6-SNAPSHOT",
      "2020.0.5-SNAPSHOT": "Spring Boot >=2.5.6-SNAPSHOT and <2.6.0-M1",
      "2021.0.0-M1": "Spring Boot >=2.6.0.M1 and <2.6.0-SNAPSHOT",
      "2021.0.0-SNAPSHOT": "Spring Boot >=2.6.0-SNAPSHOT"
    },
    "spring-cloud-gcp": {
      "2.0.4": "Spring Boot >=2.4.0-M1 and <2.6.0-M1"
    },
    "spring-cloud-services": {
      "2.3.0.RELEASE": "Spring Boot >=2.3.0.RELEASE and <2.4.0-M1",
      "2.4.1": "Spring Boot >=2.4.0-M1 and <2.5.0-M1"
    },
    "spring-geode": {
      "1.3.12.RELEASE": "Spring Boot >=2.3.0.M1 and <2.4.0-M1",
      "1.4.11": "Spring Boot >=2.4.0-M1 and <2.5.0-M1",
      "1.5.5": "Spring Boot >=2.5.0-M1 and <2.6.0-M1",
      "1.6.0-M3": "Spring Boot >=2.6.0-M1"
    },
    "vaadin": {
      "14.7.1": "Spring Boot >=2.1.0.RELEASE and <2.6.0-M1"
    },
    "wavefront": {
      "2.0.2": "Spring Boot >=2.1.0.RELEASE and <2.4.0-M1",
      "2.1.1": "Spring Boot >=2.4.0-M1 and <2.5.0-M1",
      "2.2.0": "Spring Boot >=2.5.0-M1"
    }
  },
  "dependency-ranges": {
    "native": {
      "0.9.0": "Spring Boot >=2.4.3 and <2.4.4",
      "0.9.1": "Spring Boot >=2.4.4 and <2.4.5",
      "0.9.2": "Spring Boot >=2.4.5 and <2.5.0-M1",
      "0.10.0": "Spring Boot >=2.5.0-M1 and <2.5.2",
      "0.10.1": "Spring Boot >=2.5.2 and <2.5.3",
      "0.10.2": "Spring Boot >=2.5.3 and <2.5.4",
      "0.10.3": "Spring Boot >=2.5.4 and <2.5.5",
      "0.10.4": "Spring Boot >=2.5.5 and <2.5.6-SNAPSHOT",
      "0.10.5-SNAPSHOT": "Spring Boot >=2.5.6-SNAPSHOT and <2.6.0-M1"
    },
    "okta": {
      "1.4.0": "Spring Boot >=2.2.0.RELEASE and <2.4.0-M1",
      "1.5.1": "Spring Boot >=2.4.0-M1 and <2.4.1",
      "2.0.1": "Spring Boot >=2.4.1 and <2.5.0-M1",
      "2.1.1": "Spring Boot >=2.5.0-M1 and <2.6.0-M1"
    },
    "mybatis": {
      "2.1.4": "Spring Boot >=2.1.0.RELEASE and <2.5.0-M1",
      "2.2.0": "Spring Boot >=2.5.0-M1"
    },
    "camel": {
      "3.5.0": "Spring Boot >=2.3.0.M1 and <2.4.0-M1",
      "3.10.0": "Spring Boot >=2.4.0.M1 and <2.5.0-M1",
      "3.11.1": "Spring Boot >=2.5.0.M1 and <2.6.0-M1"
    },
    "open-service-broker": {
      "3.2.0": "Spring Boot >=2.3.0.M1 and <2.4.0-M1",
      "3.3.0": "Spring Boot >=2.4.0-M1 and <2.5.0-M1"
    }
  }
}

在idea 中推荐使用Maven Helper插件,会在pom文件中看到详细的依赖之间关系。 当项目中出现依赖冲突时,可以手动exclude排除依赖

SpringCloud各种组件的停更/升级/替换

老版本使用组件

组件的升级

对于开发人员来说, 版本不停的更新演进, 组件进行、更新、升级、替换,都需要投入精力去学习, 不与时俱进就会被时代所淘汰, 学的头秃==||。


和光同尘,与时舒卷;戢鳞潜翼,思属风云