Nonexistent resource

Let's send a GET request to http://localhost:8080/non-existing-resource using a header (Content-Type:application/json).

The following screenshot shows the response when we execute the request:

The response is as shown in the following code snippet:

    {      "timestamp": 1484027734491,      "status": 404,      "error": "Not Found",      "message": "No message available",      "path": "/non-existing-resource"    }

Some important things to note are as follows:

  • The response header has an HTTP status of 404 - Resource Not Found
  • Spring Boot returns a valid JSON ;message as a ;response with the ;message stating that the resource is not found

Get Mastering Spring 5.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.