0

I have several controllers in a spring mvc application. They are regular beans that inherit from MultiActionController. They also have a custom MethodNameResolver that inspects a certain request parameter.

Now I am trying to use a new controller - a pojo with @Controller annotation. I am using @RequestMapping to resolve methods.

I am not sure if I understand this correctly, but as explained here in the spring reference, it is possible to use @RequestMapping with various filters (e.g. GET vs POST) without specifying a path, and then if a url applies to several methods then Spring falls back to InternalPathMethodNameResolver to decide which method to invoke.

How can I tell Spring to fall back to my custom MethodNameResolver? Is it enough to inject the resolver to my pojo controller?
(my controller doesn't inherit from any Spring specific class)

Yoni
  • 10,171
  • 9
  • 55
  • 72

1 Answers1

1

I guess you need to declare AnnotationMethodHandlerAdapter bean and set its methodNameResolver property.

axtavt
  • 239,438
  • 41
  • 511
  • 482
  • Thanks, this is exactly what I needed, in combination with DefaultAnnotationHandlerMapping – Yoni Mar 17 '11 at 11:46