Skip to content

Support for module installation #27

@frabass

Description

@frabass

Currently in order to add more bindings you can either combine modules (~/andThen) or mergeWithReplace (also withBindingModules but has the limitation that applies only to empty modules)

Problem with 1: it returns a combined module so you'll end up having to manually combine in the main module all your submodules

Problem with 1 and 2: mergeWithReplace allows you to distribute module installation as in Guice and mix it into modules that already contain bindings which is nice
Eample
Mod A:
bind a to ...
bind b to ...
withMergeReplace(Mod B)

ModB
bind c to ...
etc...

The only problem is that both andThen and mergeWithReplace apply overriding policies and so you could end up wiping a binding without knowing it because the project is broad, Guice throws an exception at runtime complaining about accidental (not forced override) double bindings.

Would it be possible to add something similar to Guice binder.install? Which basically is exactly withMergeReplace without replacing and signaling an accidental double binding.

http://google-guice.googlecode.com/git/javadoc/com/google/inject/Binder.html#install(com.google.inject.Module)

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions