To me, use of Spring prototype beans is a pretty natural extension of using Spring in the first place. We have a large application which is using primarily XML config for Spring. By wiring things via XML, it makes configuration more transparent, and it allows for easier customization. To implement customizability, all you have to do is expose a property in a Spring bean, and to use it, all you have to do is change the XML.
Naturally, I want to extend this customizability to non-singletons, so that’s where prototype beans come in. It’s straightforward to write a factory method that just calls getBean() on the ApplicationContext.
I’m not sure how many people use this pattern, but it’s been very useful and general for me.
↧
Reply To: Spring prototype beans not reloaded
↧