1) To use thymeLeaf add dependency in POM
2) Add a new file in resources/templates (Probably a static html page with error.html)
3) Check if any applicatoin.properties need to be added
and
if we want to response with our own HTTP Error code: @ResponseStatus Annotation can be used
where when user tries access the end point /people/{id} then along with the function result, it returns HTTP error code as Not found (404)
To be practical we can do this when any exception is raised in the applicable as below
results 404 with the along with message "Cound not find the person" as message. Exception is there because the site.properties is not having the values which are explained in previous posts.
No comments:
Post a Comment