解决方法是
@RequestMapping(value = "processing", method = RequestMethod.GET)public @ResponseBody ProcessResponse processData(@RequestParam("workflow") final String workflow, @RequestParam("conf") final String value, @RequestParam("dc") final String dc, HttpServletRequest request) { System.out.println(workflow); System.out.println(value); System.out.println(dc); System.out.println(request.getRemoteAddr()); // some other pre }添加
HttpServletRequest request到您的方法定义中,然后使用Servlet API
spring文档在这里说
15.3.2.3支持的处理程序方法参数和返回类型
Handler methods that are annotated with @RequestMapping can have very flexible signatures.Most of them can be used in arbitrary order (see below for more details).Request or response objects (Servlet API). Choose any specific request or response type,for example ServletRequest or HttpServletRequest



