How to map Page to Page in spring-data-rest

后端 未结 9 1655
太阳男子
太阳男子 2021-01-30 12:37

When I hit the database with PagingAndSortingRepository.findAll(Pageable) I get Page. However, I want to expose DTO\'s to the clien

9条回答
  •  终归单人心
    2021-01-30 13:15

    use lambda expression is more convenient

    Page dto=objectRepository.findAll(pageable).map((object -> DozerBeanMapperBuilder.buildDefault().map(object, ObjectDto.class)));
    

提交回复
热议问题