A Spring Boot 2.7 web application relies on Spring MVC's default request-path matching to route requests to its `@RequestMapping` handlers. Compared with Spring Boot 2.5, what changed by default in how incoming paths are matched against mapping patterns, and what is a practical consequence?
A. Since Boot 2.6 the default `spring.mvc.pathmatch.matching-strategy` is `PathPatternParser` (replacing `AntPathMatcher`): each pattern is pre-parsed once into a reusable `PathPattern` for faster matching, and a `**` wildcard is only allowed at the end of a pattern.Correct answer
Correct. Spring Boot 2.6 switched the Spring MVC default matching strategy to `PathPatternParser`. It compiles each mapping into a `PathPattern` once (faster at request time) and constrains `**` to the final segment, so a pattern such as `/a/**/b` that `AntPathMatcher` accepted is now rejected. Setting the property back to `ant-path-matcher` restores the old engine.
B. Nothing changed: Spring MVC still uses `AntPathMatcher` by default in Boot 2.6/2.7, and `PathPatternParser` is only ever used by Spring WebFlux.
`PathPatternParser` originated in WebFlux, but Boot 2.6 made it the Spring MVC default as well. `AntPathMatcher` is now the opt-in strategy, not the default.
C. The default is still `AntPathMatcher`, but suffix pattern matching (`.*`) was re-enabled by default so `/orders` also matches `/orders.json`.
Suffix pattern matching was deprecated and disabled by default well before this change, and `PathPatternParser` does not support it at all. The default matcher changed; suffix matching was not re-enabled.
D. `PathPatternParser` must be enabled per controller with an annotation; there is no global default, so behavior is unchanged unless each controller opts in.
The strategy is a global default controlled by the `spring.mvc.pathmatch.matching-strategy` property, not a per-controller annotation.
Explanation
Spring Boot 2.6 changed the default Spring MVC path-matching strategy from `AntPathMatcher` to `PathPatternParser` (property `spring.mvc.pathmatch.matching-strategy`, default `path-pattern-parser`). `PathPatternParser` compiles each mapping pattern once into a reusable `PathPattern`, which is more efficient at request time, and it restricts the `**` wildcard to the final path segment, so previously-valid patterns like `/a/**/b` are rejected. Suffix pattern matching is not supported. An application that needs the legacy engine sets the strategy back to `ant-path-matcher`.