if you do not want your objects to be in Singleton scope,
just use Provider in following fashion.
no configuration is necessary.

public class MyClass {

private final Provider<Foo> fooProvider;

@Inject
public MyClass(Provider<Foo> fooProvider){
this.fooProvider = fooProvider;
}

public void myMethod(){

Foo foo = fooProvider.get(); // this result in on-demand instantiatin of 
Foo.
                              
           // when you inject Provider<Foo> in the constructor,
                                         // it is not instantiated. when you 
call .get(), only at that point
                                        // foo instance is created

}

}

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to