RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
HttpServletRequest request = (HttpServletRequest) requestAttributes.resolveReference(RequestAttributes.REFERENCE_REQUEST);
StringBuffer requestURL = request.getRequestURL();
//获得url
System.out.println(requestURL);
String method = request.getMethod();
System.out.println(method)
RequestContextHolder获取请求url
最新推荐文章于 2023-03-30 17:54:10 发布