Provide the matched PathPattern as a request attribute in MVC

Author: wilkinsonaCreated Sep 11, 2026Updated Sep 11, 2026
Labelsin: webtype: enhancement

On the WebMvc side, the PathPattern's pattern string is made available as a request attribute:

https://github.com/spring-projects/spring-framework/blob/c1d4a76692949bdcdebae4b98b104174e4b951cf/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/RequestMappingInfoHandlerMapping.java#L174

On the WebFlux side, the PathPattern itself is available:

https://github.com/spring-projects/spring-framework/blob/c1d4a76692949bdcdebae4b98b104174e4b951cf/spring-webflux/src/main/java/org/springframework/web/reactive/handler/AbstractUrlHandlerMapping.java#L167

Could a new attribute be introduced on the MVC side that exposes the PathPattern?

If we had the PathPattern on the MVC side, I think we could rework this WebMvc-based code in Boot to match more closely to its WebFlux-based equivalent.

Source: spring-projects/spring-framework