@Test public void testGet2() throws Exception { ResultActions resultActions = mvc.perform(MockMvcRequestBuilders.get("/users/1")); resultActions.andExpect(MockMvcResultMatchers.status().isOk()); resultActions.andExpect(MockMvcResultMatchers.content().json("{\n" + "\"id\": 1,\n" + "\"username\": \"username:1\"\n" + "}")); resultActions.andDo(MockMvcResultHandlers.print()); MvcResult mvcResult = resultActions.andReturn(); System.out.println("拦截器数量：" + mvcResult.getInterceptors().length); }
@GetMapping("/v2/{id}") public UserVO get2(@PathVariable("id") Integer id) { return userService.get(id); }
UserController { @GetMapping("/v2/{id}") public UserVO get2(@PathVariable("id") Integer id) { return userService.get(id); } }
UserController { @GetMapping("/v2/{id}") public UserVO get2(@PathVariable("id") Integer id) { return userService.get(id); }  }
UserController { @GetMapping("/v2/{id}") public UserVO get2(@PathVariable("id") Integer id) { return userService.get(id); }  @GetMapping("") List<UserVO> list(); @GetMapping("/{id}") UserVO get(@PathVariable("id") Integer id); @GetMapping("/v2/{id}") UserVO get2(@PathVariable("id") Integer id); @PostMapping("") Integer add(UserAddDTO addDTO); @PutMapping("/{id}") Boolean update(@PathVariable("id") Integer id, UserUpdateDTO updateDTO); @DeleteMapping("/{id}") Boolean delete(@PathVariable("id") Integer id); }
UserController { @GetMapping("/v2/{id}") public UserVO get2(@PathVariable("id") Integer id) { return userService.get(id); }  @GetMapping("") List<UserVO> list(); @GetMapping("/{id}") UserVO get(@PathVariable("id") Integer id); @GetMapping("/v2/{id}") UserVO get2(@PathVariable("id") Integer id); @PostMapping("") Integer add(UserAddDTO addDTO); @PutMapping("/{id}") Boolean update(@PathVariable("id") Integer id, UserUpdateDTO updateDTO); @DeleteMapping("/{id}") Boolean delete(@PathVariable("id") Integer id);  }