我正在从事Spring Boot项目,并且我希望对某些服务进行设置限制。例如,我想在1分钟内5请求发送到此端点。
@GetMapping(path = "/allJobsByChartCode/{chartCode}",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ResponseEntity<Page<?>> getallOCMJobsByChartCode(@PathVariable("chartCode") String chartCode,@RequestParam int page,@RequestParam int size,@RequestParam(required = false,name = "orderby") String orderby,name = "direction") String direction) {
Page<OCMJobsDTO> gridData = ocmJobsService.getallOCmJobsByChartCode(chartCode,PageRequest.of(page,size),orderby,direction);
if (gridData.isEmpty()) {
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
} else {
return new ResponseEntity<>(gridData,HttpStatus.OK);
}