Spring MVC - the answer
1 answer
If you are in the context of a web application (it looks like you), you can automatically connect to HttpServletRequest or HttpServletResponse.
A request / response from the current request area will be entered.
@Component
public class SomeComponentInAWebApplicationContext {
@Autowired
private HttpServletRequest request;
@Autowired
private HttpServletResponse response;
...
}
+4
source to share