Using the instance factory method to create prototype beans dynamically?

I think what you're saying is that you have a factory which is a singleton and you want it to create new objects of which you want a new one each time with full dependency injection. The old way of doing that was Method Injection which you link to above. The new (and arguably cleaner way) is to use a Scoped Proxy.

You can either use annotations or regular config but the idea is that you create a proxy around the bean (e.g. The InnerObject). When ever you need a reference to it, spring will automatically provide you with a new copy with the appropriate dependencies inserted.

1 It turns out that this doesn't actually work for prototype beans. It did however lead me to method injection, which solves the problem - not quite as cleanly, but still nicely. Thanks dough – idbentley Apr 14 at 18:29.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions