title: Difference between HttpStatus.CREATED and URI LOCATION
body: <p>I have a post method in my controller class to create an offer and i want to show response status of 201 i.e. created when hitting the api via postman.
  This can be achieved by two methods which are
  @ResponseStatus(HttpStatus.CREATED) and ResponseEntity. I wanted to know what is the difference between the two. I have put them in comments below.</p>
  <pre><code>@PostMapping(&quot;/offers&quot;)
  **//@ResponseStatus(HttpStatus.CREATED)**
  public ResponseEntity&lt;Object&gt; createOffer(@Valid @RequestBody Offer offer) {
      Offer uoffer =  offerService.createOffer(offer);
      
      URI location = ServletUriComponentsBuilder.fromCurrentRequest().path(&quot;/{jobTitle}&quot;).
              buildAndExpand(uoffer.getJobTitle()).toUri();
  
      **return ResponseEntity.created(location).build();**
      
  }
  </code></pre>