Creating a Guice module

In earlier chapters you saw how Guice's @ImplementedBy annotation is used to designate the default implementation of an interface.

Guice has another more flexible configuration mechanism, namely a Guice Module which you code yourself.

Moreover, the configuration that you place in a Guice Module takes precedence over any @ImplementedBy annotations in the code, which allows you to configure Guice to use your custom implementation instead of the default implementation. This may be useful for customisation or testing purposes.

To create your own Guice Module, follow these steps: