As of Spring MVC 3, AbstractCommandController
is deprecated so you can no longer specify the command class in setCommandClass()
. Instead you hard-code the command class in the parameter list of a request handler. For example,
@RequestMapping(method = RequestMethod.POST)
public void show(HttpServletRequest request, @ModelAttribute("employee") Employee employee)
My problem is that I'm developing a generic page that allows the user to edit a generic bean, so the command class isn't known until the run-time. If the variable beanClass
holds the command class, with AbstractCommandController
, you would simply do the following,
setCommandClass(beanClass)
Since I can't declare the command object as a method parameter, is there any way to have Spring bind request parameters to a generic bean in the body of the request handler?