Marcin Waldowski
2008-10-18 12:46:25 UTC
Hello.
Is there an easy way to inject dependencies to already instantiated
object (setter or annotated field injection)?
I need to use some api which give me a chance to do something with
component after instantiation. The idea is to use PicoContainer to
inject dependensies using setter or annotated field injection to already
instantiated object.
It looks like this:
public class PicoInjectorComponentListener
implements ComponenInstantiationtListener {
/**
* @see ComponenInstantiationtListener#afterInstantiation(Object)
*/
public void afterInstantiation(Object newComponent) {
// TODO:
// inserting dependencies to newComponent
// using PicoContainer API
}
}
Unfortunately I cannot change existing api to use PicoContainer in a
standard way.
I found that AnnotatedFieldInjector and SetterInjector have a method
decorateComponentInstance but I cannot figure out how to use it. Can I
ask for any hint?
Regards,
Marcin Waldowski
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
Is there an easy way to inject dependencies to already instantiated
object (setter or annotated field injection)?
I need to use some api which give me a chance to do something with
component after instantiation. The idea is to use PicoContainer to
inject dependensies using setter or annotated field injection to already
instantiated object.
It looks like this:
public class PicoInjectorComponentListener
implements ComponenInstantiationtListener {
/**
* @see ComponenInstantiationtListener#afterInstantiation(Object)
*/
public void afterInstantiation(Object newComponent) {
// TODO:
// inserting dependencies to newComponent
// using PicoContainer API
}
}
Unfortunately I cannot change existing api to use PicoContainer in a
standard way.
I found that AnnotatedFieldInjector and SetterInjector have a method
decorateComponentInstance but I cannot figure out how to use it. Can I
ask for any hint?
Regards,
Marcin Waldowski
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email