> Peter Niederwieser <pnied...@gmail.com> 
> I'd be interested to see a ServiceLifecycle implementation for prototype
> scope.

Kristian Marinkovic <kristian.marinko...@porsche.co.at> wrote on 
16/09/2009 11:39:16:
> it is doable.... 
> 
> create a  - let's say - a factory service with a Bean getBean() method.
> then create a service for the Bean interface by using the 
> PropertyShadowBuilder
...
> when you
> access the bean, the factory.getBean() method will be called. and if you 

> always create a new bean you have what you need.

But bear in mind that you will get a new bean for *every method call* - 
which is probably not what you want. The thing about prototype beans in 
Spring is that you get a new instance when you request the bean from the 
container and after that it remains the same instance.

I think the only way to do it, is to expose the factory as the service, as 
I described here:
http://www.nabble.com/Re%3A-How-to-create-analog-of-Spring-FactoryBean--p25349917.html

The main downside I found is that you can't use the IOC container to 
proxy/decorate/advise the created instance.

- Paul







---

This e-mail may contain confidential and/or privileged information. If you are 
not the intended recipient (or have received this e-mail in error) please 
notify the sender immediately and delete this e-mail. Any unauthorized copying, 
disclosure or distribution of the material in this e-mail is strictly forbidden.

Please refer to http://www.db.com/en/content/eu_disclosures.htm for additional 
EU corporate and regulatory disclosures.

Reply via email to