The value for annotation attribute PageableDefault

2019-06-01 06:23发布

问题:

I already went through many links but did not find solution. Here is my code:

@Value("${paging.default.pageSize}")
public int pageSize;

Controller method:

@GetMapping()
public ResponseEntity<Page<Employee>> getAllEmployee(@PageableDefault(size = pageSize) Pageable pageable) {
    return countryService.findAllCountries(pageParams, pageable);
}

The value for annotation attribute PageableDefault.size must be a constant expression