vendredi 20 février 2015

Autowiring HttpServletRequest in Spring controller



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?




Aucun commentaire:

Enregistrer un commentaire