Karl,

re your point 1;
I haven't looked at Guice, but if it has similar features to Spring, you
could consider the following strategies:

i) mark your bean for lazy instantiation (and first ask for the instance
only once the Wicket app is in the desired state).
ii) use some sort of proxy that your bean delegates access to the state in
question (that depends on the context) on demand (ie hopefully after you
have had a chance to properly initialise things).
iii) use a factory for your bean to give you more control over creation.
iV) hook into lifecycle or application events, initialising the state of
your bean based-on container (or Wicket) generated events that signify that
things are ready/in place.

I would be surprised if Guice doesn't support at least one of the above
solutions out of the box or provide some other features for such problems.

Let us know how you get on.

Regards - Cemal
http://www.jWeekend.co.uk http://jWeekend.co.uk 


Karl M. Davis-3 wrote:
> 
> Howdy all, 
> 
> I've started using wicket-guice in one of my projects this week, but I've
> got a couple of problems I'm hoping that someone here can help me with: 
> 
> 1. I have a singleton binding that needs access to the context parameters
> (e.g. ((WebApplication)
> WebApplication.get()).getServletContext().getInitParameter(PREFERENCES_STORE_KEY);
> ). However, the WebApplication isn't bound/available until after
> GuiceWebApplicationFactory finishes creating the injector (and all of the
> singletons have been instantiated). Can anyone think of any workarounds
> for this problem? 
> 
> 2. I'm curious what the alternative web.xml configuration listed in
> GuiceWebApplicationFactory 's javadoc will do. Can anyone explain what it
> means for it to "dig the Injector out of the ServletContext as an
> attribute"? 
> 
> That's all for now. Thanks for any help you can offer! 
> 
> Best regards, 
> Karl M. Davis 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/wicket-guice-Questions-tp18638293p18642425.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to