Hi

This query is similar in nature to the recent post "Inject in Modules" so it 
may yield the same response!

I am currently refactoring our services framework to fix some issues, one of 
which was having a static reference to an Injector.

My pattern is as follows:

1. Instantiate my bootstrap class (This will have the injector as an instance 
variable)
2. Use Java 6 ServiceLoader to discover all Modules
3. Module uses ServiceLoader to discover it's relationships and does explicit 
bindings which are injected into the services classes
4. Bootstrap iterarates Modules calling start() on them

(Note - My Modules also provide access to the Service for Lifecycle mgmt e.g. 
start, stop, restart etc )

My problem is that doing Discovery in the Module means that the instances used 
have not been injected with their member variables.

What options do I have here? I thought, though it seems a bit ugly, that I 
could  iterate my Modules again and call a postConfigure() method with my 
injector.

Regards

John

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en.

Reply via email to