PDA

View Full Version : Maverick bridge or adapter with Spring


richmoore
Mar 23rd, 2006, 11:00 AM
We are integrating an existing Maverick app with a Spring/Sitemesh application. Want to utilize auth and Context from Spring app and integrate the Maverick page views (there is already close alignment of persistent models between the two projects.)

Any literature or online references available discussing integration of Maverick (Throwaway Beans) with Spring framework?

Thanks,

-- Rich Moore

richmoore
Apr 2nd, 2006, 05:59 PM
First, thanks to the many postings and support in the forum, very helpful.

It's quite possible there are other solutions, and better ones, to suggestions here. Please add to the thread if so.

Integrating a legacy Maverick application into Spring primarily impacts the controller and view layers. Models worked quite nicely as is within Spring framework.

Controllers
-- Maverick implementation used a HibernateUtil class as a helper for Hibernate session and interceptor management. The use of dependency injection and Spring Hibernate utility classes made it straightforward to utilize the Spring framework with a small number of adapter methods and classes. Docs and other references covering Spring O/R mapping (in this case to Hibernate) very helpful.

View
-- Have not identified any nice way of accomplishing this. Since Maverick "suggests" a Controller-as-Model pattern, refactoring for ModelAndView object for web presentation was involved. Essentially created new controllers patterned on other Spring controllers and separated out Maverick controller logic as a manager called by the new Spring style controllers. The class dependency chain in Maverick (for example Protected->Authenticated->Errorable->ThrowawayBean2) appears more complex than actually is. Essentially broke the class hierarchy at Authenticated and replaced with a new base class compliant with existing Spring framework implementation with some adapters for previous Maverick approach methods.

If the implementation is using Hibernate Sessions, note there are possible issues with LazyLoading implemented in the Spring/Hibernate layer which can be resolved for web presentation using the Open Session in View pattern via OpenSessionInViewFilter (web.xml Servlet filter) or OpenSessionInViewInterceptor (bean registration in DispatcherServlet context) Searching on these can provide some online articles and examples for these.

-- Rich