Comment by [email protected]:

import java.util.concurrent.atomic.AtomicInteger;

import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Inject;
import com.google.inject.Injector;
import com.google.inject.Module;
import com.google.inject.Provider;

public class InjectProviderExample {
        public static void main(String... args) {
                Module myModule = new AbstractModule() {
                        @Override
                        protected void configure() {
                                // NOTICE THERE IS NO toProvider HERE
                                bind(Foo.class).to(FooImpl.class);
// bind(Foo.class).to(FooImpl.class).in(Singleton.class);
                        }
                };

                Injector inj = Guice.createInjector(myModule);
                Bar myBar = inj.getInstance(Bar.class);
                Foo fooOne = myBar.getFoo();
                Foo fooTwo = myBar.getFoo();

you can also take on this blog site: http://nfljerseyscheapjerseyscheapnfljerseys.blogspot.com

For more information:
http://code.google.com/p/google-guice/wiki/InjectingProviders

--
You received this message because you are subscribed to the Google Groups 
"google-guice-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice-dev.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to