Oh, well, if you're just storing the app context in the page, that's
probably fine. Just not the individual beans. But, I wouldn't even
store that. It's not an expensive lookup (no thread-bound stuff if
you're looking from the application or a component) and then you don't
have to worry about it being serialized.

On 7/11/05, Matej Knopp <[EMAIL PROTECTED]> wrote:
> The BeanFactory is created only on application startup. It's put in the
> application constructor. Or am I missing something?
> 
> Actually, i'm using the spring ContextLoaderListener and then find the
> ApplicationContext in the ServletContext.
> I have this line in my Application.init () function
> 
> ContextProvider.init (getWicketServlet ().getServletContext ());
> 
> and the ContextProvider class looks like this:
> 
> public class ContextProvider {
>         static ApplicationContext context = null;
>         public static ApplicationContext getContext () {
>                 if (context != null)
>                         return context;
>                 else
>                         throw new InfrastructureException ("Uninitialized 
> Spring Context!");
>         }
> 
>         public static void init (ServletContext servletContext) {
>                 context = (ApplicationContext) servletContext.getAttribute
> (WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
>         }
> }
> 
> 
> Phil Kulak wrote:
> > Woa, Nick, not a good option. Creating an XmlBeanFactory is very
> > expensive, something you want to do on application startup only, not
> > every page creation.
> >
> > -Phil
> >
> > On 7/11/05, Nick Heudecker <[EMAIL PROTECTED]> wrote:
> >
> >>Here's how I'm approaching it now:
> >>
> >>public class MyApplication extends WebApplication {
> >>
> >>    private XmlBeanFactory beans;
> >>
> >>    public MyApplication() {
> >>        ClassPathResource res = new 
> >> ClassPathResource("applicationContext.xml");
> >>        beans = new XmlBeanFactory(res);
> >>    }
> >>
> >>    public Object getBean(String name) {
> >>        return beans.getBean(name);
> >>    }
> >>
> >>}
> >>
> >>And I'll just reference it from my Page classes using
> >>getApplication().getBean("...").
> >>
> >>
> >>
> >>On 7/11/05, Phil Kulak <[EMAIL PROTECTED]> wrote:
> >>
> >>>Holding the beans in the pages is not a good idea. I did this for a
> >>>bit, but the pages are serialized and your app-context beans aren't.
> >>>So then you have to make your app-context beans serializable, which
> >>>defeats the point of having an app context.
> >>>
> >>>-Phil
> >>>
> >>>On 7/11/05, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
> >>>
> >>>>What would you need to make it pretty? If you have concrete idea's on
> >>>>how we can improve Wicket for this, please share them.
> >>>>
> >>>>Eelco
> >>>>
> >>>>Gustavo Hexsel wrote:
> >>>>
> >>>>
> >>>>> One possible way would be to have a parent page class that would hold 
> >>>>> it, and customize your page factory to set it in all created pages.  
> >>>>> It's pretty easy.  Let me know if you can't picture it and I'll try to 
> >>>>> write a sample code.
> >>>>>
> >>>>> I use dependency injection in most of my pages and unfortunately, it 
> >>>>> doesn't look nearly as pretty as I wanted it to.  Most Wicket examples 
> >>>>> favour service locator instead... I guess you might find yourself in 
> >>>>> the same boat.
> >>>>>
> >>>>> []s Gus
> >>>>>
> >>>>>
> >>>>>---------- Início da mensagem original -----------
> >>>>>
> >>>>>     De: [EMAIL PROTECTED]
> >>>>>   Para: [email protected]
> >>>>>     Cc:
> >>>>>   Data: Mon, 11 Jul 2005 11:16:47 -0500
> >>>>>Assunto: [Wicket-user] Spring Integration
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>>Hi,
> >>>>>>
> >>>>>>I'm looking into Wicket and would like to know what the preferred
> >>>>>>method of integrating Wicket with Spring.  I'll need access to the
> >>>>>>bean factory in the page classes.  I checked the wiki and didn't see
> >>>>>>anything.  Thanks for the help.
> >>>>>>
> >>>>>>-Nick
> >>>>>>
> >>>>>>
> >>>>>>-------------------------------------------------------
> >>>>>>This SF.Net email is sponsored by the 'Do More With Dual!' webinar 
> >>>>>>happening
> >>>>>>July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
> >>>>>>core and dual graphics technology at this free one hour event hosted by 
> >>>>>>HP,
> >>>>>>AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
> >>>>>>_______________________________________________
> >>>>>>Wicket-user mailing list
> >>>>>>[email protected]
> >>>>>>https://lists.sourceforge.net/lists/listinfo/wicket-user
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>
> >>>>>__________________________________________________________________________
> >>>>>UOL Fone: Fale com o Brasil e o Mundo com até 90% de economia.
> >>>>>http://www.uol.com.br/fone
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>-------------------------------------------------------
> >>>>>This SF.Net email is sponsored by the 'Do More With Dual!' webinar 
> >>>>>happening
> >>>>>July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
> >>>>>core and dual graphics technology at this free one hour event hosted by 
> >>>>>HP,
> >>>>>AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
> >>>>>_______________________________________________
> >>>>>Wicket-user mailing list
> >>>>>[email protected]
> >>>>>https://lists.sourceforge.net/lists/listinfo/wicket-user
> >>>>>
> >>>>>
> >>>>
> >>>>
> >>>>
> >>>>-------------------------------------------------------
> >>>>This SF.Net email is sponsored by the 'Do More With Dual!' webinar 
> >>>>happening
> >>>>July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
> >>>>core and dual graphics technology at this free one hour event hosted by 
> >>>>HP,
> >>>>AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
> >>>>_______________________________________________
> >>>>Wicket-user mailing list
> >>>>[email protected]
> >>>>https://lists.sourceforge.net/lists/listinfo/wicket-user
> >>>>
> >>>
> >>>
> >>>-------------------------------------------------------
> >>>This SF.Net email is sponsored by the 'Do More With Dual!' webinar 
> >>>happening
> >>>July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
> >>>core and dual graphics technology at this free one hour event hosted by HP,
> >>>AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
> >>>_______________________________________________
> >>>Wicket-user mailing list
> >>>[email protected]
> >>>https://lists.sourceforge.net/lists/listinfo/wicket-user
> >>>
> >>
> >>
> >>-------------------------------------------------------
> >>This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
> >>July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
> >>core and dual graphics technology at this free one hour event hosted by HP,
> >>AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
> >>_______________________________________________
> >>Wicket-user mailing list
> >>[email protected]
> >>https://lists.sourceforge.net/lists/listinfo/wicket-user
> >>
> >
> >
> >
> > -------------------------------------------------------
> > This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
> > July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
> > core and dual graphics technology at this free one hour event hosted by HP,
> > AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
> > _______________________________________________
> > Wicket-user mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/wicket-user
> >
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
> July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
> core and dual graphics technology at this free one hour event hosted by HP,
> AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
> _______________________________________________
> Wicket-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>


-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to