findAll
Atualizado
Atualizado
Controller
@GetMapping
public ResponseEntity<Page<UserDTO>> findAll(Pageable pageable) {
Page<UserDTO> list = userService.findAll(pageable);
return ResponseEntity.ok().body(list);
}
Service
public Page<UserDTO> findAll(Pageable pageable) {
Page<User> users = userRepository.findAll(pageable);
return users.map(UserDTO::new);
}