官网版本对应地址:https://start.spring.io/actuator/info
SpringCloud版本 | SpringBoot版本 |
2022.0.0-M2 | Spring Boot >=3.0.0-M2 and < 3.1.0-M1 |
2022.0.0-M1 | Spring Boot >=3.0.0-M1 and < 3.0.0-M2 |
2021.0.3 | Spring Boot >=2.6.1 and < 3.0.0-M1 |
2021.0.0-RC1 | Spring Boot >=2.6.0-RC1 and <2.6.1 |
2021.0.0-M3 | Spring Boot >=2.6.0-M3 and <2.6.0-RC1 |
2021.0.0-M1 | Spring Boot >=2.6.0-M1 and <2.6.0-M3 |
2020.0.5 | Spring Boot >=2.4.0.M1 and <2.6.0-M1 |
Hoxton.SR12 | Spring Boot >=2.2.0.RELEASE and <2.4.0.M1 |
Hoxton.BUILD-SNAPSHOT | Spring Boot >=2.2.0.BUILD-SNAPSHOT |
Hoxton.M2 | Spring Boot >=2.2.0.M4 and <=2.2.0.M5 |
Greenwich.BUILD-SNAPSHO | Spring Boot >=2.1.9.BUILD-SNAPSHOT and <2.2.0.M4 |
Greenwich.SR2 | Spring Boot >=2.1.0.RELEASE and <2.1.9.BUILD-SNAPSHOT |
Greenwich.M1 | Spring Boot >=2.1.0.M3 and <2.1.0.RELEASE |
Finchley.BUILD-SNAPSHOT | Spring Boot >=2.0.999.BUILD-SNAPSHOT and <2.1.0.M3 |
Finchley.SR4 | Spring Boot >=2.0.3.RELEASE and <2.0.999.BUILD-SNAPSHOT |
Finchley.RC2 | Spring Boot >=2.0.2.RELEASE and <2.0.3.RELEASE |
Finchley.RC1 | Spring Boot >=2.0.1.RELEASE and <2.0.2.RELEASE |
Finchley.M9 | Spring Boot >=2.0.0.RELEASE and <=2.0.0.RELEASE |
Finchley.M7 | Spring Boot >=2.0.0.RC2 and <=2.0.0.RC2 |
Finchley.M6 | Spring Boot >=2.0.0.RC1 and <=2.0.0.RC1 |
Finchley.M5 | Spring Boot >=2.0.0.M7 and <=2.0.0.M7 |
Finchley.M4 | Spring Boot >=2.0.0.M6 and <=2.0.0.M6 |
Finchley.M3 | Spring Boot >=2.0.0.M5 and <=2.0.0.M5 |
Finchley.M2 | Spring Boot >=2.0.0.M3 and <2.0.0.M5 |
☆博主在使用的版本★:
- Jdk: 1.8
- Spring Boot : 2.3.9.RELEASE
- Spring Cloud: Hoxton SR12
- Spring Cloud AliBaBa: 2.2.5.RELEASE
三、Spring boot最新追踪
正式版本即将在2022 年11月Spring Boot 3.0正式发布,它将基于Spring Framework 6.0,并且需要 Java 17 或更高版本,同时它也将是Jakarta EE 9的第一个Spring Boot版本。留给开发者的时间不多了,那么我们如何过渡到Spring Boot 3.0,今天告诉大家一些方法,以便于将来快速迁移到3.0。快来一睹为快。
Spring Boot 3.0M1 一些已知的变更
为了跟上形势,一些已知的变化更需要大家知道。
移除Spring Boot 2.x的弃用API
Spring Boot 2.x 中弃用的类、方法和属性会在3.0版本中删除。
最低Java要求
- 从Spring Boot 3.0开始:
- Java 17是最低版本,Java 8不再被兼容。
- 到正式版发行的时候Java 19也应该发行了。
Jakarta EE 9
Spring Boot 依赖于 Jakarta EE 规范,3.0 已经升级到 Jakarta EE 9 版本。因此Spring Boot 3.0 会使用 Servlet 5.0规范和JPA 3.0规范。相关的三方依赖如果不支持这些规范,将减少或者移除这些依赖。所以相关的三方依赖请尽快根据 Jakarta EE 9 进行版本迭代。基于这个原因,目前不支持Jakarta EE 9的类库将被移除,包含了一些知名三方类库,例如EhCache3、Jersey、JOOQ、Thymeleaf等等,直到这些类库适配 Jakarta EE 9。
(永久)移除支持
以下三个中间件单独被列了出来,感觉像是永久不再支持了。
Apache ActiveMQ
Atomikos
EhCache 2
依赖升级
Spring Boot 3.0的一些Spring依赖项目也都升级到了新的里程碑版本,其中包含了Spring Security 6.0-M1。Jakarta EE相关的模块也升级到了Jakarta EE 9。
更多特性参见Spring Boot3.0M1更新日志
Spring Boot 3.0迁移指南
配置文件机制的更改
在Spring Boot 2.4中,配置文件 application.properties 和 application.yaml 的加载机制被改变,目的是为了简化外部配置的加载方式,使之更加合理,带来的是不向下兼容。为了平滑升级,Spring 提供了一个配置项来兼容旧机制:
例如,你可以有一个src/main/resources/application
。 属性如下:
spring.config.use-legacy-processing=true
多文档Yaml
如果你在yaml配置文件中使用了间隔符—来声明多文档的话,你得知道现在按文档声明的顺序来注册声明的配置属性;而在 Spring Boot 2.3 及更早版本中,基于配置文件激活顺序。举个例子:
spring:
profiles:
active: test
application:
name: test-service
server:
spring:
profiles:
active: uat
application:
name: test-service
server:
port: 8080
这个配置文件在Spring Boot 2.3以前的版本中会根据spring.profiles.active来决定加载的环境。但是从2.4开始后面的属性会覆盖前面的属性。
外部配置总是覆盖jar内的配置
如果你的配置文件在jar之外,并且该配置文件适用于特定的环境,例如application-dev.yaml。2.4以下的版本中,在jar外面的application.yaml
不会覆盖jar中的application-<profile名称>.yaml
文件,从2.4开始外部文件将总是覆盖jar内的配置文件。你需要检查你是否存在这种情况。
激活配置文件
如果您使用spring.profiles
属性来激活环境配置,那么现在就应该迁移到spring.config.activate.on-profile
。
旧玩法:
spring:
profiles: "dev"
secret: "dev-password"
新玩法:
spring:
config:
activate:
on-profile: "dev"
secret: "dev-password"
这真是折腾人啊。spring.profiles.active仍然可以用来激活特定的环境,例如命令行:
$ java -jar myapp.jar --spring.profiles.active=prod
你也可以在 application.properties 或 application.yaml 中使用spring.profiles.active,从2.4开始spring.profiles.active不能在特定环境中使用,也就是说application-.yaml中不能使用,—间隔的多文档中也不能使用它。一句话,你不能再通过spring.profiles.active来合并一个包含了spring.config.activate.on-profile属性的配置文件。
同样的机制, spring.profiles.include属性只能在非特定配置文件中使用,下面的配置是无效的:
无效配置
spring:
config:
activate:
on-profile: "prod"
profiles:
include: "metrics"