Issue 1:
marc schipperheyn opened SPR-9253 and commented

This is best explained by an example

@Controller
@RequestMapping("/base")
public class MyController{

@RequestMapping(method = RequestMethod.GET, value = "/start.html")
public String doSomething(
ModelMap model,
NativeWebRequest request) throws Exception {
[...]

@RequestMapping(method = RequestMethod.POST, value = "/start.html")
public String doSomething(
@ModelAttribute("vo") MyVO vo,
BindingResult result,
ModelMap model,
NativeWebRequest request) throws Exception {
[...]
}

@Controller
@RequestMapping("/base/extend")
public class MyExtendedController extends MyController{

@RequestMapping(method = RequestMethod.GET, value = "/start.html")
public String doSomething(
ModelMap model,
NativeWebRequest request) throws Exception {
[...]

@RequestMapping(method = RequestMethod.POST, value = "/start.html")
public String doSomething(
@ModelAttribute("vo") MyVO vo,
BindingResult result,
ModelMap model,
NativeWebRequest request) throws Exception {
[...]
}

This will make Spring think start.html occurs twice in the same controller and throw and IllegalStateException.

The reason to want to extend controllers is to be able to use common methods.

AFAIK, the only way to extend controllers is to use RequestMapping at the Controller level. It is not possible to just use RequestMappings at the method level in this scenario. I consider it very inelegant, especially in the context of REST, that the urlpath has to be unique at an endpoint level ("/start.html"). It should be unique taken into account the entire requestmapping ("/base/start.html", "/base/extend/start.html".

Issue Links:

#14003 Ambiguous handler mapping exception for unambiguous mappings ("duplicates")

Issue 2:
marc schipperheyn opened SPR-9366 and commented

@Controller
@RequestMapping("/my")
public class MyController extends ExtendedController

@RequestMapping(method = RequestMethod.POST, value = "/post/")
public String post(
@ModelAttribute("vo") MyVO vo,
BindingResult result,
ModelMap model,
NativeWebRequest request) throws Exception{
[...]

@Controller
@RequestMapping("/my/extend")
public class MyController extends ExtendedController

@RequestMapping(method = RequestMethod.POST, value = "/post/")
public String extendPost(
@ModelAttribute("vo") MyVO vo,
BindingResult result,
ModelMap model,
NativeWebRequest request) throws Exception{

This leads to

java.lang.IllegalStateException: Ambiguous handler methods mapped for HTTP path '/my/extend/post/': {public java.lang.String nlproject.controller.MyExtendController.extendPost(nl.project.VO.MyVO,org.springframework.validation.BindingResult,org.springframework.ui.ModelMap,org.springframework.web.context.request.NativeWebRequest) throws java.lang.Exception, public java.lang.String nl.project.controller.MyController.post(nl.project.VO.MyVO,org.springframework.validation.BindingResult,org.springframework.ui.ModelMap,org.springframework.web.context.request.NativeWebRequest)}. If you intend to handle the same path in multiple methods, then factor them out into a dedicated handler class with that path mapped at the type level!
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter$ServletHandlerMethodResolver.resolveHandlerMethod(AnnotationMethodHandlerAdapter.java:642)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:431)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:424)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789)

The exception suggests that the paths are identical, which they are not. Apparently, Spring checks for path uniqueness at the method level without taking into account the base mapping at the classlevel.

Issue Links:

#13891 Controller extension doesn't allow extending REST Urls ("is duplicated by")