Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the framework principal mechanism to load Modules #1

Open
hprange opened this issue Apr 4, 2012 · 2 comments
Open

Use the framework principal mechanism to load Modules #1

hprange opened this issue Apr 4, 2012 · 2 comments
Assignees
Labels

Comments

@hprange
Copy link
Owner

hprange commented Apr 4, 2012

The Injector initialization can search for modules declared via Wonder's framework principal mechanism.

@ghost ghost assigned hprange Apr 4, 2012
@alextu
Copy link

alextu commented Jun 4, 2013

Our first idea was to iterate over all the framework bundles, take the sharedInstance of their principal class and if they implemented a ModuleProvider interface (with a modules() method), we retrieved the modules from there. But that didn't work because the principal classes are not all available at this point (when InjectableApplication calls getModules())

So for the moment, we've implemented it in each FrameworkPrincipal's finishInitialization method by contributing a list of modules of our base application class :

   @Override
   public void finishInitialization() {
       ModuleRegister moduleRegister = MyApplication.application().getModuleRegister();
       moduleRegister.addModule(new MyModule());
   }

Then in our base application class :

@Override
protected Module[] modules() {
    List<? extends Module> modules = moduleRegister.modules();
    return (Module[]) modules.toArray(new Module[modules.size()]);
}

@hprange
Copy link
Owner Author

hprange commented Jun 15, 2013

Thanks for sharing the idea and code. I'll try to address some issues of WOInject after WOWODC.

@hprange hprange modified the milestone: woinject-1.2 Feb 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants