May 31st, 2012, 10:02 AM
Spring MVC 2.5 upgrade to Spring 3.1
We are working on a large web application. The current application is written on SpringMVC 2.5. We need to upgrade to 3.1. There is a specific way that controllers are currently designed. There are 2 base controllers which extend from AbstractFormController and BaseCommandController. The controllers don't have any logic but have the common code applicable to every request (setting locale, handling errors, cross site scripting check, etc). Each one of those controllers has a helper field. The helper contains all the logic required to complete a specific request. The application has a many of these helpers. We use xml config to:
- create a new bean of one of the two types of controllers with a specific id
- inject a proper helper
- configure the bean with views to use
- map a url to the new bean by id using SimpleUrlHandlerMapping
In spring 3, the controllers are annotated. This changes things. Does that mean my controller class can only have one bean instance with specific name and can only be mapped to a single url pattern? So, would i need to write a new controller for every helper i have and copy/call/inherit all the common code?
There's gotta be a better way. Please help.