spring boot获取当前请求的url
ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); HttpServletRequest request = requestAttributes.getRequest(); String url = "http://" + request.getServerName() + ":" + request.getServerPort();