Spring MockMVC inject mockHttpServletRequest when not in method signature
问题 Given I have inherited some Spring MVC controller code with signature @RequestMapping(value = "/upload", method = RequestMethod.POST) public ModelAndView upload(HttpServletRequest request, HttpServletResponse response) { String remoteAddress = request.getRemotedAddr(); auditService.logAddress(remoteAddress); // do work... return mav; } and I have a Spring MockMvc test that performs the test public void someTest() { mockMvc().perform(fileUpload("/upload").file(FileFactory.stringContent("myFile