title: Spring Boot Rest Controller how to return different HTTP status codes?
body: <p>I am using Spring Boot for a simple REST API and would like to return a correct HTTP statuscode if something fails.</p>
  
  <pre><code>@RequestMapping(value="/rawdata/", method = RequestMethod.PUT)
  @ResponseBody
  @ResponseStatus( HttpStatus.OK )
  public RestModel create(@RequestBody String data) {
      // code ommitted..
      // how do i return a correct status code if something fails?
  }
  </code></pre>
  
  <p>Being new to Spring and Spring Boot, the basic question is how do i return different status codes when something is ok or fails?</p>