title: Return response messages in spring boot
body: <p>I am working with spring boot with a h2 database. I would like to return a 201 message when the register is inserted succesfully and a 400 when is duplicated. I am using ResponseEntity to achieve this, fot example , the next is my create method from the Service:</p>
  
  <pre><code>    @Override
      public ResponseEntity&lt;Object&gt; createEvent(EventDTO eventDTO) {
          if (eventRepository.findOne(eventDTO.getId()) != null) {
              //THis is a test, I am looking for the correct message
              return new ResponseEntity(HttpStatus.IM_USED);
          }
          Actor actor = actorService.createActor(eventDTO.getActor());
          Repo repo = repoService.createRepo(eventDTO.getRepo());
          Event event = new Event(eventDTO.getId(), eventDTO.getType(), actor, repo, createdAt(eventDTO));
          eventRepository.save(event);
          return new ResponseEntity(HttpStatus.CREATED);
      }
  </code></pre>
  
  <p>This is my controller:</p>
  
  <pre><code>    @PostMapping(value = "/events")
      public ResponseEntity addEvent(@RequestBody EventDTO body) {
          return eventService.createEvent(body);
      }
  </code></pre>
  
  <p>But I'm not getting any message in the browser, I am doing different tests with postman and when I consult for all the events, the result is correct, but each time that I make a post I dont get any message in the browser, I am not pretty sure what is the cause of this issue. Any ideas?</p>