Skip to content

Add option to configure PathPatternParser in Spring MVC #21694

Closed
@bclozel

Description

@bclozel

As of Spring Framework 5.3 (See spring-projects/spring-framework#24945), it will be possible to use PathPatternParser to parse and match request mapping path patterns, as an alternative to the current default AntPathMatcher.

This new implementation has been used for a while already in Spring WebFlux and is stable.
It’s been designed for consistency and performance, fixing issues we’ve seen in the past with the AntPathMatcher variant.

We should consider switching to this new variant in MVC; there are behavior differences and incompatible changes between the two. For example, double wildcards are rejected when used in the middle of the pattern. See spring-projects/spring-framework#24952

We could offer a new configuration property for switching between the two implementations and even choose PathPatternParser as the default one. In case existing applications use invalid patterns, a PatternParseException will be raised during application startup - we could create a dedicated failure analyzer to guide developers in those cases: fix the pattern if possible or switch back the implementation using the new property.

Edit: in the meantime, a blog post explaining these changes has been published.

Metadata

Metadata

Assignees

Labels

status: noteworthyA noteworthy issue to call out in the release notestype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions