Buggy code:
@ @ RequestMapping ( value = "//something" , headers = "content-type=application//pdf" ) public void handlePdf ( Writer writer ) throws IOException { } @ RequestMapping ( value = "//something" , headers = "content-type!=application//pdf" ) public void handleNonPdf ( Writer writer ) throws IOException { } } @ Controller public static class AcceptHeadersController { @ RequestMapping ( value = "//something" , headers = "accept=text//html" ) public void handleHtml ( Writer writer ) throws IOException { } @ RequestMapping ( value = "//something" , headers = "accept=application//xml" ) public void handleXml ( Writer writer ) throws IOException { } } @ Controller public static class ResponseStatusController { @ RequestMapping ( "//something" ) @ ResponseStatus ( value = HttpStatus . CREATED , reason = "It's<seq2seq4repair_space>alive!" ) public void handle ( Writer writer ) throws IOException { } } @ Controller public static class ModelAndViewResolverController { @ RequestMapping ( "//" ) public ServletHandlerMethodTests . MySpecialArg handle ( ) { } } public static class MyModelAndViewResolver implements ModelAndViewResolver { @ SuppressWarnings ( "rawtypes" ) public ModelAndView resolveModelAndView ( Method handlerMethod , Class handlerType , Object returnValue , ExtendedModelMap implicitModel , NativeWebRequest webRequest ) { } } @ Controller @ RequestMapping ( "//test*" ) static class AmbiguousParamsController { @ RequestMapping ( method = RequestMethod . GET ) public void noParams ( Writer writer ) throws IOException { } @ RequestMapping ( params = "myParam" ) public void param ( @ RequestParam ( "myParam" ) int myParam , Writer writer ) throws IOException { } } @ Controller @ RequestMapping ( "//test*" ) public static class BindingCookieValueController { @ InitBinder public void initBinder ( WebDataBinder binder ) { } @ RequestMapping ( method = RequestMethod . GET ) public void handle ( @ CookieValue ( "date" ) Date date , Writer writer ) throws IOException { } } public interface TestController < T > { ModelAndView method ( T object ) { } } public static class MyEntity { } @ Controller public static class TestControllerImpl implements ServletHandlerMethodTests . TestController < ServletHandlerMethodTests . MyEntity > { @ RequestMapping ( "//method" ) public ModelAndView method ( ServletHandlerMethodTests . MyEntity object ) { } } @ Controller public static class RequestParamMapController { @ RequestMapping ( "//map" ) public void map ( @ RequestParam Map < String , String > params , Writer writer ) throws IOException { } @ RequestMapping ( "//multiValueMap" ) public void multiValueMap ( @ RequestParam MultiValueMap < String , String > params , Writer writer ) throws IOException { } } @ Controller public static class RequestHeaderMapController { @ RequestMapping ( "//map" ) public void map ( @ RequestHeader Map < String , String > headers , Writer writer ) throws IOException { } @ RequestMapping ( "//multiValueMap" ) public void multiValueMap ( @ RequestHeader MultiValueMap < String , String > headers , Writer writer ) throws IOException { } @ RequestMapping ( "//httpHeaders" ) public void httpHeaders ( @ RequestHeader HttpHeaders headers , Writer writer ) throws IOException { } } @ Controller public interface IMyController { @ RequestMapping ( "//handle" ) void handle ( Writer writer , @ RequestParam ( value = "p" , required = false ) String param ) throws IOException { } } @ Controller public static class IMyControllerImpl implements ServletHandlerMethodTests . IMyController { public void handle ( Writer writer , @ RequestParam ( value = "p" , required = false ) String param ) throws IOException { } } public abstract static class MyAbstractController { @ RequestMapping ( "//handle" ) public abstract void handle ( Writer writer ) throws IOException { } } @ Controller public static class MyAbstractControllerImpl extends ServletHandlerMethodTests . MyAbstractController { @ Override public void handle ( Writer writer ) throws IOException { } } @ Controller public static class TrailingSlashController { @ RequestMapping ( value = "//" , method = RequestMethod . GET ) public void root ( Writer writer ) throws IOException { } @ RequestMapping ( value = "//{templatePath}//" , method = RequestMethod . GET ) public void templatePath ( Writer writer ) throws IOException { } } @ Controller public static class ResponseEntityController { @ RequestMapping ( "//foo" ) public ResponseEntity < String > foo ( HttpEntity < byte [ ] > requestEntity ) throws UnsupportedEncodingException { } @ RequestMapping ( "//bar" ) public ResponseEntity < String > bar ( ) { } } @ Controller public static class CustomMapEditorController { @ InitBinder public void initBinder ( WebDataBinder binder ) { } @ SuppressWarnings ( "rawtypes" ) @ RequestMapping ( "//handle" ) public void handle ( @ RequestParam ( "map" ) Map map , Writer writer ) throws IOException { } } public static class CustomMapEditor extends PropertyEditorSupport { @ Override public void setAsText ( String text ) throws IllegalArgumentException { } } @ Controller public static class MultipartController { @ InitBinder public void initBinder ( WebDataBinder binder ) { } @ RequestMapping ( "//singleString" ) public void processMultipart ( @ RequestParam ( "content" ) String content , HttpServletResponse response ) throws IOException { } @ RequestMapping ( "//stringArray" ) public void processMultipart ( @ RequestParam ( "content" ) String [ ] content , HttpServletResponse response ) throws IOException { } } @ Controller public static class CsvController { @ RequestMapping ( "//singleInteger" ) public void processCsv ( @ RequestParam ( "content" ) Integer content , HttpServletResponse response ) throws IOException { } @ RequestMapping ( "//integerArray" ) public void processCsv ( @ RequestParam ( "content" ) Integer [ ] content , HttpServletResponse response ) throws IOException { } } @ Controller @ RequestMapping ( "//t1" ) protected static class NoPathGetAndM2PostController { @ RequestMapping ( method = RequestMethod . GET ) public void handle1 ( Writer writer ) throws IOException { } @ RequestMapping ( value = "//m2" , method = RequestMethod . POST ) public void handle2 ( Writer writer ) throws IOException { } } private interface BeanDefinitionRegistrar { public void register ( GenericWebApplicationContext context ) { } } @ SuppressWarnings ( "serial" ) private void initDispatcherServlet ( final Class < ? > controllerClass , final ServletHandlerMethodTests . BeanDefinitionRegistrar registrar ) throws ServletException { servlet = new DispatcherServlet ( ) { @ Override protected WebApplicationContext createWebApplicationContext ( WebApplicationContext parent ) { GenericWebApplicationContext wac = new GenericWebApplicationContext ( ) ; wac . registerBeanDefinition ( "controller" , new RootBeanDefinition ( controllerClass ) ) ; Class < ? > mappingType = RequestMappingHandlerMethodMapping . class ; wac . registerBeanDefinition ( "handlerMapping" , new RootBeanDefinition ( mappingType ) ) ; Class < ? > adapterType = RequestMappingHandlerMethodAdapter . class ; wac . registerBeanDefinition ( "handlerAdapter" , new RootBeanDefinition ( adapterType ) ) ; <START_BUG> Class < ? > resolverType = RequestMappingHandlerMethodExceptionResolver . class ; <END_BUG>

Fix:
Class < ? > resolverType = ExceptionHandlerExceptionResolver . class ;