只需将请求注入您的服务即可:
@Autowired private HttpServletRequest request;
为了使其正常工作,您需要预先注册RequestContextListener,但是:
@Bean public RequestContextListener requestContextListener(){ return new RequestContextListener();}
只需将请求注入您的服务即可:
@Autowired private HttpServletRequest request;
为了使其正常工作,您需要预先注册RequestContextListener,但是:
@Bean public RequestContextListener requestContextListener(){ return new RequestContextListener();}