对于多个uri映射到同一个control方法时,需根据不同的uri返回的数据结构进行区分,因此需要再方法体内获取到RequestUri,再对其做相应的判断实现对应的业务逻辑
@Resource
private RequestMappingHandlerMapping requestMappingHandlerMapping;
@GetMapping({"getNextOpenTime","getNextOpenTime2"})
public ReturnDTO<NextOpenTimeBO> getNextOpenTime(String gameCode,HttpServletRequest request) {
UrlPathHelper urlPathHelper = requestMappingHandlerMapping.getUrlPathHelper();
System.out.println(urlPathHelper.getRequestUri(request));///api/provide/getNextOpenTime2
System.out.println(urlPathHelper.getServletPath(request));//包含context-path路径 /lottery/api/provide/getNextOpenTime contextPath+requestUri=servletPath
}