Created
July 16, 2022 10:00
-
-
Save atesibrahim/6433136bb8c4a2a766e55d85f2bc00e9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@AllArgsConstructor | |
@Service | |
public class BookService { | |
@Autowired | |
private BookRepository bookRepository; | |
public List<Book> findAll() { | |
Iterable<Book> book = bookRepository.findAll(); | |
List<Book> books = new ArrayList<>(); | |
book.iterator().forEachRemaining(books::add); | |
return books; | |
} | |
public Book save(Book book) { | |
return bookRepository.save(book); | |
} | |
public void deleteById(String id) { | |
bookRepository.deleteById(id); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment