@ExceptionHandler on CGLib-proxied controller is ineffectual [SPR-5959] #10627
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
status: duplicate
A duplicate of another issue
William Ashley opened SPR-5959 and commented
Here is a condensed example of the problem I'm encountering:
Controller:
Dispatcher servlet config:
web.xml
The exception handler is never invoked when the controller is proxied by CGLib (removing
@Transactional
removes the proxy and restores the exception handler). A little digging led me to org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerExceptionResolver where there is this iteration over methods of the controllerwhich does arrive eventually at the proper exception handler method of my controller class, but because of the call to ClassUtils.getMostSpecificMethod() it winds up back at the overridden method on the CGLib-generated class (which from what I noticed it had already visited). I haven't researched enough to say this is the problem though.
@RequestMapping
annotations appear to work normally through a proxied controller (and the@Transactional
annotation does function correctly), so I'm hoping this can be fixed.Affects: 3.0 M3
Issue Links:
@ExceptionHandler
doesn't work on CGLib-proxied controller in Portlet MVC1 votes, 2 watchers
The text was updated successfully, but these errors were encountered: