我的请求网址如 http://localhost:8080/api/create/ , Controller 有以下代码
@RequestMapping(value = "/", method = RequestMethod.GET)
public ResponseEntity<String> getApiResponse(HttpServletRequest request)
throws Exception {}
控件将如何到达此方法?我在 Spring 有任何方法可以做到这一点,因为我希望请求映射 url 仅是“/”
最佳答案
应该是:
@RequestMapping(value = "/create", method = RequestMethod.GET)
关于java - 无法在 Controller 中映射 url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9390850/