Currently, I am working on a project to upgrade it to Spring Boot 3, Spring 6, and Java 17. But I am facing an issue with HttpStatus. I have a method that returns HttpStatus.NO_CONTENT and HttpStatus.INTERNAL_SERVER_ERROR.
But it looks like HttpStatus is deprecated in Spring 6 so how can I handle this issue? While building a project with HttpStatus getting compilation error as incompatible types: HttpStatusCode cannot be converted to HttpStatus.
Change it to return an HttpStatusCode instead, e.g.
return HttpStatusCode.valueOf(HttpStatus.NO_CONTENT.value());
HttpStatusCode is an interface that could represent any 3-digit integer, while HttpStatus can only enumerate limited values.