32689 introduced an instanceof HandlerFunction check in AbstractHandlerMethodExceptionResolver which creates a package cycle between org.springframework.web.servlet.handler and org.springframework.web.servlet.function(.support). Since this is just for identification and not making use of the actual HandlerFunction interface itself, we could detect a marker interface instead - implemented by HandlerFunction but living in the org.springframework.web.servlet parent package - or use an annotation to identify such pass-through handler objects that are supported next to HandlerMethod instances in AbstractHandlerMethodExceptionResolver.

Comment From: simonbasle

For the second approach, I wonder if @FunctionalInterface would be a fit 🤔 wdyt @jhoeller?

Comment From: jhoeller

It looks like we can simply move the original instanceof HandlerFunction check down to ExceptionHandlerExceptionResolver which lives in the web.servlet.mvc rather than the web.servlet.handler package, being able to refer to web.servlet.function as well.