Mar 14th, 2012, 10:10 AM
Overriding bean scope
(I'm using Spring v3.1.1.)
I'm fond of the request bean scope and started using it heavily in my web services. I have run into a small issue, however.
After I implement the domain logic, which may use singleton-scoped or prototype-scoped beans, I wrap a web service interface around it. To avoid concurrency issues, I redefine some of the singleton-scoped or prototype-scoped beans (predominantly those that aren't stateless) to be request-scoped.
Unfortunately I need to duplicate the domain model's bean definitions in my service's bean definition and add a scope="request" property and a <aop:scoped-proxy> section to each bean that I redefine.
Is it possible to extend a bean definition instead of overriding it completely?
I have full access to the code and bean definition files.
Tags for this Thread