SPR-6502 - Broken @RequestMapping inheritance
This commit is contained in:
@@ -1257,6 +1257,28 @@ public class ServletAnnotationControllerTests {
|
||||
assertEquals("create", response.getContentAsString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void requestMappingInterface() throws Exception {
|
||||
initServlet(IMyControllerImpl.class);
|
||||
|
||||
MockHttpServletRequest request = new MockHttpServletRequest("GET", "/handle");
|
||||
MockHttpServletResponse response = new MockHttpServletResponse();
|
||||
servlet.service(request, response);
|
||||
assertEquals("handle", response.getContentAsString());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void requestMappingBaseClass() throws Exception {
|
||||
initServlet(MyAbstractControllerImpl.class);
|
||||
|
||||
MockHttpServletRequest request = new MockHttpServletRequest("GET", "/handle");
|
||||
MockHttpServletResponse response = new MockHttpServletResponse();
|
||||
servlet.service(request, response);
|
||||
assertEquals("handle", response.getContentAsString());
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Controllers
|
||||
*/
|
||||
@@ -2140,5 +2162,34 @@ public class ServletAnnotationControllerTests {
|
||||
|
||||
}
|
||||
|
||||
public interface IMyController {
|
||||
|
||||
@RequestMapping("/handle")
|
||||
void handle(Writer writer) throws IOException;
|
||||
}
|
||||
|
||||
@Controller
|
||||
public static class IMyControllerImpl implements IMyController {
|
||||
|
||||
public void handle(Writer writer) throws IOException {
|
||||
writer.write("handle");
|
||||
}
|
||||
}
|
||||
|
||||
public static abstract class MyAbstractController {
|
||||
|
||||
@RequestMapping("/handle")
|
||||
public abstract void handle(Writer writer) throws IOException;
|
||||
}
|
||||
|
||||
@Controller
|
||||
public static class MyAbstractControllerImpl extends MyAbstractController {
|
||||
|
||||
@Override
|
||||
public void handle(Writer writer) throws IOException {
|
||||
writer.write("handle");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user