Hello,
I'm evaluating Spring MVC 3.1.2 for a new project and I've been trying to do the following thing.
I've a class annotated as @controller and a method marked with @RequestMapping. If I navigate with a browser to the url mapped in the @RequestMapping everything works fine and the handler is called.
My handler method accepts a parameter which is a bean that is filled when the handler is called.
What I would like to do is have the possibility to modify the bean values before it is filled with the data from the request.
I've tried using an HandlerMethodArgumentResolver and this gets called only if there are no annotations on the parameter ( this is not the case as I'm trying to define how to fill the bean using a custom annotation ). From what I've understood custom ArgumentResolvers will not be called if there are annotations. So I should be changing the default ArgumentResolvers but they cannot be configured using the xml because the method setArgumentResolvers of the class RequestMappingHandlerAdapter accepts a List<HandlerMethodArgumentResolver> while the getter returns HandlerMethodArgumentResolverComposite.
So I've create a BeanPostProcessor to call the setArgumentResolvers and change the list of the base resolvers. This is still not working and I get the following exception:
java.lang.IllegalStateException: An Errors/BindingResult argument is expected to be immediately after the model attribute argument in the controller method signature

Now I'm trying to use an HandlerInterceptorAdapter but I'm not sure this is the right way to go.
Has anybody tried to do something like this ?


Thanks,
Stefano