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
-~----------~----~----~----~------~----~------~--~---