In high volume (~50,000 requests per second) java web-app I\'m using ThreadLocal to execute a task which should be executed per request scope.
I could achieve the same e
The Spring solution will cost more but will make for cleaner code IMO. There are a lot of steps involved in fetching, creating, initializing, and storing a bean. However you won't have to think about clearing the request scoped bean as you would the ThreadLocal
. It will be collected when the corresponding ServletRequest
is cleaned up.