Skip to content

Instantly share code, notes, and snippets.

@atesibrahim
Created July 16, 2022 10:00
Show Gist options
  • Save atesibrahim/6433136bb8c4a2a766e55d85f2bc00e9 to your computer and use it in GitHub Desktop.
Save atesibrahim/6433136bb8c4a2a766e55d85f2bc00e9 to your computer and use it in GitHub Desktop.
@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