Skip to content

Commit 638de99

Browse files
committed
Diffblue
1 parent f6545ba commit 638de99

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package de.rieckpil.blog.library;
2+
3+
import java.awt.print.Book;
4+
5+
import org.springframework.beans.factory.annotation.Autowired;
6+
import org.springframework.http.ResponseEntity;
7+
import org.springframework.web.bind.annotation.GetMapping;
8+
import org.springframework.web.bind.annotation.PathVariable;
9+
import org.springframework.web.bind.annotation.RequestMapping;
10+
import org.springframework.web.bind.annotation.RestController;
11+
12+
@RestController
13+
@RequestMapping("/books")
14+
public class BookController {
15+
private final BookService bookService;
16+
17+
@Autowired
18+
public BookController(BookService bookService) {
19+
this.bookService = bookService;
20+
}
21+
22+
@GetMapping("/{id}")
23+
public ResponseEntity<Book> getBookById(@PathVariable Long id) {
24+
Book book = bookService.findById(id);
25+
if (book != null) {
26+
return ResponseEntity.ok(book);
27+
} else {
28+
return ResponseEntity.notFound().build();
29+
}
30+
}
31+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package de.rieckpil.blog.library;
2+
3+
import java.awt.print.Book;
4+
5+
import org.springframework.stereotype.Service;
6+
7+
@Service
8+
public class BookService {
9+
Book findById(Long id) {
10+
return null;
11+
}
12+
}

0 commit comments

Comments
 (0)