You can use a ref to refer to the factory bean to inject it into the property
of another bean, that won't cause the factory to be invoked.  The factory
bean is invoked when specified by by a blueprint bean declaration that uses
the factory-* attributes of the bean.  You might want to link the xsd to
your blueprint document so that you can get xml completion and help with
what elements and attributes are available.  That would probably help you
immensely.  

I believe that you might be able to accomplish what you want if you declare
a prototype bean that references a factory for instantiation.  Then if you
also have a prototype bean which is exposed as a service, you could
reference the first bean as a property of the second bean.  This way, when
the service gets created, a new instance of the service bean will be
created, then when injecting it's property that refers to the first bean,
the factory should be invoked and a new instance of that bean be created. 
This would only work with prototype beans though since once a singleton bean
is created, even if it references a prototype bean in one of it's
properties, the singleton bean won't need to be instantiated again.

I also haven't tried exactly what I described above, but it should work if
you refer to a prototype bean from a prototype bean exposed as a service.

You can find some helpful code snippets on the apache aries blueprint
examples page.



--
View this message in context: 
http://karaf.922171.n3.nabble.com/Blueprint-scope-and-reference-list-tp4028901p4029042.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Reply via email to