You're using ControllerClassNameHandlerMapping
with an assumption that is not correct; from Java doc:
Implementation of HandlerMapping that follows a simple convention for generating URL path mappings from the class names of registered Controller beans as well as @Controller annotated beans.
The documentation does not say that it also follows method names. The main reference of comparing "handler mappings" for your controller is the @RequestMapping
annotations put on your methods. So, with your controller Spring reads them as:
{methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}
for all the defined methods in AccessController
that has the following @RequestMapping
:
@RequestMapping(method = RequestMethod.GET)
That's why you see the ambiguous exception.
To my understanding, the cleanest solution is to use value
attribute of @RequestMapping
to define different request URIs. It's not really recommended to go for a solution that tries to map request URIs to method names.