Autowiring HttpServletRequest in Spring controller

java, spring, spring-mvc

Solution

if it works that means spring doesn't inject exactly http request but a proxy. the proxy delegates calls to current http request

Problem

Let's say I have a Spring controller. ``` @RequestMappin("/path") public MyController { } ``` As stated, default scope of the controller is Singleton. I know that I can autowire request in REQUEST scope beans, however, if I try to autowire request, so that ``` @RequestMappin("/path") public MyController { @Autowired private HttpServletRequest request; } ``` It still works, and for each request I get appropriate request object. Does it mean that autowire works regardless the scope is request or not?

Original source