I just migrated an application to Spring Boot 3 and before the migration I used HttpStatus to obtain more details about the error message that a certain web client returned with the gerReasonPhrase() method.
Now I find that in Spring Boot 3, HttpStatus is deprecated and I have to use HttpStatusCode instead. But HttpStatusCode does not have the getReasonPhrase() method or anything similar. Is there a way to obtain the same information as before through HttpStatusCode without having to make a status code map with its corresponding messages?
I am searching a similar method in Spring Boot 3 than the one that exists in Spring Boot 2.
HttpStatus
are you talking about? The classorg.springframework.http.HttpStatus
(Spring Framework 6.1.2; e.g. Spring Boot 3.2.0 uses Spring Framework 6.1.1) doesn't seem to be deprecated. It might be a good idea to provide a minimal reproducible example of the code you're having problems with. – IroncladHttpStatus
implementsHttpStatusCode
(andHttpStatus
seems to be the only public implementation ofHttpStatusCode
), so maybe a conditional cast is sufficient to access it if you're calling some method that returnsHttpStatusCode
instead ofHttpStatus
. – Ironclad