zixzigma
unread,Feb 23, 2011, 2:13:27 PM2/23/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to google...@googlegroups.com
Hello Everyone,
I am using Spring framework on the serverside.
SpringSecurity, REST, MVC, etc.
however for DI I prefer to use Guice.
with Spring 3.0, @Autowired can accomplish same thing as @Inject,
but when writing my own code, I would like to use Guice, because of
Providers, Assisted Inject, easier AOP, etc.
I do not want to get rid of Spring IoC container entirely,
because Spring uses it internally, but I would like to adopt Guice to use DI in my own code.
- do you have any suggestion on this ? is this a bad idea ?
- do you know how I can configure Guice within Spring ?
My problem is bootstrapping Injectors, eg.
Injector injector = Guice.createInjector(new MyModule());
Foo foo = injector.getInstance(Foo.class);
I believe Guice.createInjector should be created once during bootstrapping,
When integrating with Spring, I would like to know specifically what I should register with Spring IoC.
and do I have to use injector.getInstance(xxx.class) all over my code anytime I would like to get hold of a instance of a class ?
if not, what is the purpose of injector.getInstance(xxx.class) ?
Thank You