in die Frühlingsruhe -API eingeben
@GetMapping("/rest/v1/books")public ResponseEntity<List<Book>> findAllBooks() { List<Book> books = bookService.findAll(); return ResponseEntity.ok(books); // return 200, with json body} @GetMapping("/rest/v1/books/{bookId}")public ResponseEntity<Book> findBookById(@PathVariable long bookId) { try { Book book = bookService.findById(bookId); return ResponseEntity.ok(book); // return 200, with json body } catch (ResourceNotFoundException ex) { return ResponseEntity.status(HttpStatus.NOT_FOUND).body(null); // return 404, with null body }}
Blue-eyed Bug