Spring Boot 3 中的 HttpStatusCode

问题描述 投票:0回答:1

我刚刚将一个应用程序迁移到 Spring Boot 3,在迁移之前,我使用 HttpStatus 来获取有关某个 Web 客户端通过 gerReasonPhrase() 方法返回的错误消息的更多详细信息。

现在我发现在 Spring Boot 3 中,HttpStatus 已被弃用,我必须使用 HttpStatusCode 代替。但 HttpStatusCode 没有 getReasonPhrase() 方法或类似的方法。有没有一种方法可以通过 HttpStatusCode 获取与之前相同的信息,而不必与其对应的消息制作状态码映射?

我正在 Spring Boot 3 中搜索与 Spring Boot 2 中存在的方法类似的方法。

java spring-boot http-status-codes
1个回答
0
投票

HttpStatus 在当前的 spring 版本中似乎没有被弃用。

但是有些的枚举值已被弃用(例如 CHECKPOINT)。

© www.soinside.com 2019 - 2024. All rights reserved.