Thanks..
do you have any recommendations on best way to bootstrap this for
Enterprise Application that has both Web and EJB layer.
I am more interested in bootstrapping this at EJB layer..

Thanks

On Oct 7, 5:34 pm, "Robbie Vanbrabant" <[EMAIL PROTECTED]>
wrote:
> Right, but you aren't using the injector, you also need to bootstrap the
> injection. You basically have two options:
> - Get an initial object from the Injector:
> injector.getInstance(RootType.class);
> - Inject an already existing object using the Injector:
> injector.injectMembers(someInstance);
>
> Also 
> seehttp://code.google.com/p/google-guice/source/browse/#svn/trunk/servle...
> learn how you can integrate Guice with raw servlets, or use Warp
> Servlet
> (http://www.wideplay.com).
>
> Robbie
>
> On Tue, Oct 7, 2008 at 11:19 PM, jus <[EMAIL PROTECTED]> wrote:
>
> > The injector is being created by custom servlet i have created and the
> > init method contains the snippet below...
>
> > public class StartupInitializer extends GenericServlet {
>
> >        public void init(ServletConfig config)
> >        throws ServletException
> >        {
> >                System.out.println("StartupInitializer: START INIT
> > INITIALIZED");
> >                Guice.createInjector(new GuiceSetupModule());
> >                System.out.println("StartupInitializer: END INIT
> > INITIALIZED");
>
> >        }
> > ....
>
> > Thanks for tip on Singleton, shall change ..
>
> > On Oct 7, 5:00 pm, "Robbie Vanbrabant" <[EMAIL PROTECTED]>
> > wrote:
> > > On Tue, Oct 7, 2008 at 10:48 PM, jus <[EMAIL PROTECTED]> wrote:
> > > > GuiceSetup snippet:
>
> > > >       [EMAIL PROTECTED]
> > > >        protected void configure() {
> > > >                System.out.println("GuiceSetupModule configure
> > INVOKED");
>
> > > >                bind(GatewayAccessor.class)
> > > >                .to(GatewayAccessorImpl.class)
> > > >                .in(Scopes.SINGLETON);
>
> > > >                bind(GatewayAuthenticator.class)
> > > >                .to(GatewayAuthenticatorImpl.class)
> > > >                .in(Scopes.SINGLETON);
>
> > > >                Properties properties = loadProperties();
> > > >                Names.bindProperties(binder(), properties);
> > > >          }
>
> > > As a best practice, consider binding to the Singleton annotation instead
> > of
> > > the instance (Scopes.SINGLETON).
>
> > > > Code to Inject:
>
> > > >       [EMAIL PROTECTED] @Named("gateway.UserId")
> > > >        private String userId;
> > > >       [EMAIL PROTECTED]
> > > >        private GatewayAuthenticator gatewayAuthenticator;
> > > >       [EMAIL PROTECTED]
> > > >        private GatewayAccessor gatewayAccessor;
>
> > > In which class have these fields been defined? Is it a class Guice
> > creates?
> > > (for example, servlets do not get created by Guice)
> > > Could you tell us how and when you create the Injector?
>
> > > Robbie
--~--~---------~--~----~------------~-------~--~----~
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