users@hk2.java.net

Dynamically bind a Factory to a ServiceLocator?

From: buko <buko_at_chiubarobot.com>
Date: Tue, 28 Oct 2014 20:15:02 -0400

For various reasons I'd like to be able to dynamically add a Factory to a
ServiceLocator after the ServiceLocator has been created. Try as I might
can't figure out how this is done.

Let's say I have an instance of GenericFactory<T> and a type T. Given a
ServiceLocator I'd like to add the factory instance such that other users
(before I proceed to the next runlevel) can @Inject T and it'll call the
factory instance.

I've been poking at this for a while using
BuildHelper.createConstantDescriptor and the FactoryDescriptors interface
but nothing works. Any insights on how this might look?