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
Try autowring PagedResourcesAssembler as a class member and change method signature something like below
@RepositoryRestController
public class EmployeeSearchController {
@Autowired
private EmployeeRepository employeRepository;
@Autowired
private PagedResourcesAssembler pagedAssembler;
@RequestMapping(value = "/employees/search/all/search/all", method = RequestMethod.GET)
public ResponseEntity>> getEmployees(EmployeeCriteria filterCriteria, Pageable pageable) {
//EmployeeSpecification uses CriteriaAPI to form dynamic query with the fields from filterCriteria
Specification specification = new EmployeeSpecification(filterCriteria);
Page employees = employeeRepository.findAll(specification, pageable);
return assembler.toResource(employees);
}
}
This works perfectly with Spring Data Rest 2.1.4.RELEASE