Create a class as follows:
package curam.mypackage; import com.google.inject.AbstractModule; /** * Contains my Guice bindings. */ public class MyModule extends AbstractModule { /** * {@inheritDoc} */ @Override public void configure() { // no explicit bindings } }
You can now add new Guice "bindings" to the configure method to override default implementations:
@Override public void configure() { bind(MyNewEntity.class).to(MyCustomNewEntityImpl.class); }
This configuration will cause Guice to dish up an instances of MyCustomNewEntityImpl instead of the default implementation (MyNewEntityImpl), whenever an MNewEntity interface instance is @Injected.
You will also add configuration code if your application uses events (see Events).
As such, code which is delivered to customers should not use this mechanism to bind an interface to an implementation in any situation where the customer should be permitted to specify their own binding for the interface.