/** PUT /books -> Updates an existing book. */ @RequestMapping( value = "/books", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public ResponseEntity<Book> updateBook(@RequestBody Book book) throws URISyntaxException { log.debug("REST request to update Book : {}", book); if (book.getId() == null) { return createBook(book); } Book result = bookRepository.save(book); return ResponseEntity.ok() .headers(HeaderUtil.createEntityUpdateAlert("book", book.getId().toString())) .body(result); }