title: Spring ResponseEntity best practice
body: <p>I am new to RESTful web services in general, and am learning the Spring implementation of web services.</p>
  
  <p>I am particularly interested in learning how to properly use ResponseEntity return types for most of my use cases.</p>
  
  <p>I have one endpoint:</p>
  
  <pre><code>/myapp/user/{id}
  </code></pre>
  
  <p>This endpoint supports a <code>GET</code> request, and will return a JSON formatted string of the User object whose ID is <code>{id}</code>. I plan to annotate the controller method as producing JSON.</p>
  
  <p>In the case that a user with ID <code>{id}</code> exists, I set a status of 200, and set the JSON string of the user in the body. </p>
  
  <p>In the event that no user exists with that ID, I was going to return some flavor of a 400 error, but I am not sure what to set in the body of the ResponseEntity. Since I annotate the endpoint method as producing JSON, should I come up with a generic POJO that represents an error, and return that as JSON?</p>