When I hit the database with PagingAndSortingRepository.findAll(Pageable)
I get Page
. However, I want to expose DTO\'s to the clien
This works correctly in Spring 2.0 -
@Override
public Page getBooksByAuthor(String authorId, Pageable pageable) {
Page bookEntity = iBookRepository.findByAuthorId(authorId, pageable);
return bookEntity.map(new Function() {
@Override
public BookDto apply(BookEntity t) {
return new ModelMapper().map(t, BookDto.class);
}
});
}
The converter is no longer supported in Page type for Spring 2.0. Also, the Function should be used from java.util.function.Function.