Gert,

please send me the sources (zip) and I'll add them.

Juergen

On 8/5/05, Cameron Braid <[EMAIL PROTECTED]> wrote:
> That's a great idea..
> 
> My soloution was to use this class :
> 
> public class SpringBeanSource<B> implements Serializable {
> 
>         final private String beanName;
>         private transient B bean;
> 
>         public SpringBeanSource(String beanName) {
>                 this.beanName = beanName;
>         }
> 
>         public B getBean() {
>                 if (bean == null) {
>                         // only access the bean factory if we don't have a
> transient refrence already
>                         WebRequestCycle cycle =
> (WebRequestCycle)WebRequestCycle.get();
>                         ServletContext servletContext =
> cycle.getWebRequest().getHttpServletRequest().getSession().getServletContext
> ();
>                         bean =
> (B)WebApplicationContextUtils.getRequiredWebApplicationContext(servletContex
> t).getBean(beanName);
>                 }
>                 return bean;
> 
>         }
> 
> }
> 
> Then I just pass instances like : new
> SpringBeanSource<CustomerDao>("customerDao")
> 
> Then call getBean() each time to get the actual bean.
> 
> However - being able to pass an actual CustomerDao would be much nicer :)
> 
> Cameron.
> 
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:wicket-develop-
> > [EMAIL PROTECTED] On Behalf Of Gert Jan Verhoog
> > Sent: Saturday, 6 August 2005 2:23 AM
> > To: [email protected]
> > Subject: Re: [Wicket-develop] HibernateQueryList and
> > serializing/deserializing
> >
> > On Aug 3, 2005, at 23:40, Phil Kulak wrote:
> >
> > > I really like that wrapper of yours. And that dynmic proxying could
> > > definately be nice.
> >
> > Well, I had a go at a simple implementation (130 loc, depends on
> > CGLib). Using it is pretty much transparent:
> >
> > IHibernateDao dao = (IHibernateDao) SpringLoader.load
> > ("wicketHibernateDao");
> >
> > The SpringLoader class dynamically creates a proxy and holds a
> > transient reference to the actual spring managed bean. Before every
> > method invocation, the proxy checks if the reference is null (e.g.
> > after deserialization) and retrieves the bean from Spring's
> > ApplicationContext if necessary.
> >
> > If the spring managed bean in question is a non-final concrete class,
> > SpringLoader returns a dynamically created subclass. If it's a
> > java.lang.reflect.Proxy object, it returns an object that implements
> > every interface the proxy implements. I guess this would work in most
> > cases, but it's also possible to specify a class or array of
> > interfaces if more control is needed.
> >
> > If anyone's interested, I'll gladly donate the code to wicket-contrib-
> > spring, just let me know how :-)
> >
> > cheers,
> > Gert Jan
> >
> >
> > -------------------------------------------------------
> > SF.Net email is Sponsored by the Better Software Conference & EXPO
> > September 19-22, 2005 * San Francisco, CA * Development Lifecycle
> > Practices
> > Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> > Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
> > _______________________________________________
> > Wicket-develop mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/wicket-develop
> 
> 
> 
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO
> September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
> Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
> _______________________________________________
> Wicket-develop mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-develop
>


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop

Reply via email to