Populating a spring request scoped bean in a ContainerRequestFilter Populating a spring request scoped bean in a ContainerRequestFilter spring spring

Populating a spring request scoped bean in a ContainerRequestFilter


After playing around with this I found that the proxyMode setting on the @Scope annotation did the trick anyway. So that is the solution. The proxy will take care in creating a new instance every time and will make sure it is request scoped.


You can use @RequestScope annotation which does the same.It is just an abbreviation for:

@Scope(value = "request", proxyMode = ScopedProxyMode.TARGET_CLASS)