In part1, we known that Argo use Dependency Injection to do the configuration. If you looked the maven dependency of Argo, you will find it has a dependency on guice-3.0.jar.
The main components of Google-guice dependency injection framework are @Inject annotation, and the AbstractModule class.
Let’s see an example on google code
The RealBillingService class relies on interface CreditCardProcessor and TransactionLog in constructor.
Notice that there is a @Inject annotation on the constructor. So something will be happen in Guice when the constructor of RealBillingService is called.
AbstractModule builds the object-graph of Guice, which binds the interface with the implementation by overriding the function Configure.
In this example, it bind the interface TransactionLog with DatabaseTransactionLog, and bind CreditCardProcessor with PaypalCreditCardProcessor.
We can also conclude that @Inject always comes with the bind.
After that, a Guice Injector instance can be created:
Let’s check the usage in Argo .
Guice in Argo
As you can see, in Argo.init(), a set of Module instance is created, and then the Guice.CreateInjector() function is called to bind the interface and implements.
From the name of argo.getControllerClasses(), we could inspect that these Module are the collection of Controllers Annotated by Argo.