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
