Ich Du,

No, what you need is to create a module to "normal" injections, the one that
I've told you is a special one that deals with the special characteristics
of a servlet.

The classes that will be inject must be also be mapped by Guice, you will
need something like this:

public class MainModule extends AbstractModule {
@Override
 protected void configure() {
bind(Objectify.class).toProvider(ObjectifyTransacionalProvider.class);

bind(Objectify.class).annotatedWith(Names.named("Non-Transactional")).toProvider(ObjectifyProvider.class);
bind(ObjectifyFactory.class).toInstance(ObjectifyService.factory());
...
}
}

And then install this module with the servlet module that you've installed
before. I recommend you to read the guides in the Guice page, they're very
clear. :)

*Jayr Motta*
Software Developer
*
*
I'm  on 
BlackBeltFactory.com<http://www.blackbeltfactory.com/ui#!User/jmotta/ref=jmotta>
!



On Fri, Jul 1, 2011 at 10:08 AM, ich du <[email protected]> wrote:

> thx again,
>
> i just tried to wire up my server side with guice - the rpc part is done so
> far (thx to you). but on server side i also have some pojo
> interfaces/implementation that i want to inject via guice. but how to
> bootstrap this? at the moment i just added the module to my
> GuiceServletContextListener:
>
> public class AppGuiceContextListener extends GuiceServletContextListener {
>
>     @Override
>     protected Injector getInjector() {
>         return Guice.createInjector(new ServerModule(), new
> ServletModule());
>     }
>
> }
>
> (not later than now i have to admit i am a total guice noob)
> but imho somehow i need an injector instance on server side to get
> instances of classes that use injection?! something like that:
> Injector i = Guice.createInjector(new ServerModule(), new
> ServletModule());
> ClassThatHasSom@InjectInside instance = i.getInstance(
> [email protected]);
>
> So on Server i need a reference to the injector instance?! is it a good
> idea to store the injector in a (static?) field in AppGuiceContextListener
> or should i just call getInjector() whenever i need it?
>
> --
> You received this message because you are subscribed to the Google Groups
> "google-guice" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-guice/-/orv5N_ikTo4J.
>
> 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.

Reply via email to