I believe you would have to add @Inject annotations to your constructors. If you don't, developers using the framework can always hand-code a factory of some sort (Provider in Guice/GIN) to create instances (the factory gets dependencies injected into it so that it can inject them into the objects it creates).
Also, if you don't want to add a dependency on Guice/GIN, you may be able to depend on on just javax.inject instead, though I'm not sure. It's worth looking, though, since having your library depend on GIN just got thornier with the release of GWT 2.2. Developers will have to pick a version of the GIN jar based on which version of GWT they're using. -Brian On Mon, Feb 28, 2011 at 3:24 AM, Uemit <[email protected]> wrote: > But in case I use a app-wide URL I still have to inject the URL into my > DataSource class right? > I could use Field Injection but isn't constructor injection the recommended > way to do it ? > I think it boils down to the question: What is the best practice if you want > to develop a standalone library which doesn't care if the user uses DI or > any other method to pass resources and dependencies into my library classes? > Sorry that I repeat the question but do I have to annotate the constructor > with @Inject if I want to allow for constructor based DI or is there any > other way (to avoid dependency to the guice/gin in my library)? > Thanks in advance > cheers > Uemit > > > -- > You received this message because you are subscribed to the Google Groups > "Google Web Toolkit" 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-web-toolkit?hl=en. > -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" 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-web-toolkit?hl=en.
