我想要重载Spring控制器的RequestMapping。该控制器使用POST作为请求方法,我需要传递不同的参数来进行重载。
如何在不更改URL的情况下实现这一点?
@RequestMapping(method = RequestMethod.POST, value = "/windparks/import/error")
public ModelAndView handleFileUploadError(Locale locale, @AuthenticationPrincipal SpringUser authenticatedUser, List<RegulationEvent> regList, @RequestParam("regulations") MultipartFile regulations, RedirectAttributes redirectAttributes, @PathVariable String windparkId) throws IOException, WindSpeedInterpolator.TimeSeriesMismatchException, SAXException {
ModelAndView view = new ModelAndView("uis/windparks/parkdetail");
view.addObject("failedEvents", regList);
view.addObject("windparkId", windparkId);
return view;
}
@RequestMapping(method = RequestMethod.POST, value = "/windparks/import/error")
public ModelAndView handleFileUploadError(Locale locale, @AuthenticationPrincipal SpringUser authenticatedUser, RedirectAttributes redirectAttributes, @PathVariable String windparkId) throws IOException, WindSpeedInterpolator.TimeSeriesMismatchException, SAXException {
ModelAndView view = new ModelAndView("uis/windparks/parkdetail");
view.addObject("windparkId", windparkId);
return view;
}