I want to create a REST link for an Employee entity that will basically be a findByAllFields query. Of course this should be combined with Pa
Spring HATEOAS has changed the name of Resource, PagedResources and some other classes. See here. Below is a working version in 2020.
@RepositoryRestController
public class EmployeeSearchController {
@Autowired
private EmployeeRepository employeRepository;
@Autowired
private PagedResourcesAssembler pagedAssembler;
@RequestMapping(value = "/employees/search/all", method = RequestMethod.GET)
public ResponseEntity>> getEmployees(PersistentEntityResourceAssembler entityAssembler,,
EmployeeCriteria filterCriteria,
Pageable pageable) {
Specification specification = new EmployeeSpecification(filterCriteria);
Page employees = employeeRepository.findAll(specification, pageable);
return ResponseEntity.ok(pagedAssembler.toModel(plants, (RepresentationModelAssembler) entityAssembler));
}
}