Esempio n. 1
0
  @RequestMapping(
      method = RequestMethod.POST,
      consumes = {MediaType.APPLICATION_JSON_VALUE},
      produces = {MediaType.APPLICATION_JSON_VALUE})
  public Note create(@RequestBody Note note) {

    if ("Ошибка".equals(note.getTitle())) throw new BadTitleException();
    return noteRepository.save(note);
  }
Esempio n. 2
0
 @RequestMapping(
     method = RequestMethod.GET,
     produces = {MediaType.APPLICATION_JSON_VALUE})
 public List<Note> readAll() {
   return noteRepository.findAll();
 }