You can use non-empty constructors with guice, just annotate it with @Inject to say that the construction parameters should be injected. In this case, however, I suspect that you want to provide the map as a parameter, in which case you should check out assisted injection: http://code.google.com/p/google-guice/wiki/AssistedInject
On Mon, May 10, 2010 at 4:04 PM, Christoph <[email protected]> wrote: > Hi all, > What is the best way, if guice should create an instance of a class > that has a non-empty constructor, e.g.: > class A { > private final Map<String> map; > public A(Map<String> test) { > this.map = test; > } > > Guice needs empty constructors for injection... > > -- > You received this message because you are subscribed to the Google Groups > "google-guice" 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?hl=en. > > -- You received this message because you are subscribed to the Google Groups "google-guice" 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?hl=en.
