title: How to add data using request body
body: <p>Hello I've got a task to add a book to the store. I've got action like this:</p>
  
  <pre><code>@PostMapping("/")
  public String addBook(@RequestParam Long id, @RequestParam String isbn, @RequestParam String title,
                        @RequestParam String author, @RequestParam String publisher, @RequestParam String type) {
      memoryBookService.addBook(new Book(id,isbn,title,author,publisher,type));
      return "redirect:/";
  }
  </code></pre>
  
  <p>But instead of adding the book that way I am supposed to use something like this below. The issue is that i dont know how to pass parameteres from post method to my constructor to add new book using this RequestBody. Can someone explain this to me?</p>
  
  <pre><code> @PostMapping("/")
  public String addBook(@RequestBody Book book) {
  // code
      return "redirect:/";
  </code></pre>
  
  <p>This is my JSON:</p>
  
  <pre><code>      {"id": "1L" 
        "isbn": "9788324631766"
        "title": "Thinking in Java"  
        "author": "Bruce Eckel"
        "publisher": "Helion"
        "type": "programming"
         }
  </code></pre>