Issue
I've deployed a Spring Boot application on AWS Elastic Beanstalk. I have implemented @RestControllerAdvice to handle exceptions. The returned HTTP exceptions on the local instance are in the following format
{
"timestamp": "2022-03-16T19:28:22.124+00:00",
"status": 404,
"error": "Not Found",
"message": "SOME_MESSAGE",
"path": "/some/path"
}
After I deployed the application the returned error body changed to this
{
"timestamp": "2022-03-16T19:30:37.390+00:00",
"status": 404,
"error": "Not Found",
"path": "/some/path"
}
What can I do to put the message property back?
Solution
The problem was that by default Spring Boot sets
server.error.include-message=never;
to fix it just set the property to always/on_param
server.error.include-message=always;
server.error.include-message=on_param;
Answered By - NovaBG03
Answer Checked By - Mary Flores (JavaFixing Volunteer)