Related to https://github.com/spring-projects/spring-boot/issues/34846, it would be great to refine if possible the relative ordering between RouterFunctionMapping
and other mapping to have a better consistency between Spring WebFlux (where RouterFunctionMapping
is before RequestMappingHandlerMapping
) and Spring MVC (where this is the other way around).
Comment From: sdeleuze
We are going to change, as of Spring Framework 6.1, the order of RouterFunctionMapping
defined in WebMvcConfigurationSupport
from 3
to -1
in order to achieve better consistency and reduce the surprise factor. That way, functional routes will always be before annotation-based ones.
It also makes sense from a user perspective since functional routes are kind of lower level than annotation-based ones, and the overhead will be minimal for pure annotation-based use cases because if there are no RouterFunction
in the application context, then RouterFunctionMapping::routerFunction
is null
, and the mapping does not allocate anything (no Optional<HandlerFunction<T>>
instance have to be created).