Comment by ljh552: 'I am not sure I understand the need for this code:
@Inject Injector injector; It seems to me that this is field injection to inject the Injector's dependencies ? I would think the injector would be bootstrapped and provided as a static reference for the entire application. So only one instance containing all the configuration is initialized once and broadcasted by one single static helper. I was also doing some testing and noticed that when I omitted the @Inject on the RealBillingService??????, my client code worked just fine when I ran the Junit. I thought that it wouldn't be able to find the dependencies of the constructor's args but it looks like that it did. That confuses me. Note that however, I put the TransactionLog??????, CreditCardProcessor?????? interfaces and their implementations in the same package and JAR as the RealBillingService?????? client. Could this be why Guice is able to find the proper constructor's args dependencies without the @Inject ?' Why I cannot, If I don't have the @Inject The system will throw exception and tell me cannot find the proper constructor. PS: I tested that only the constructor without the parameters and you declared obviously in the class will not need the annotation @Inject. This is the default constructor that GUICE invoke. PS2: my all the class is in the same package too! For more information: http://code.google.com/p/google-guice/wiki/GettingStarted -- You received this message because you are subscribed to the Google Groups "google-guice-dev" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-guice-dev?hl=en.
