Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt to change in default strategy for URL path matching in Spring MVC #31547

Closed
rstoyanchev opened this issue Jun 29, 2022 · 2 comments
Closed
Assignees
Labels
type: enhancement A general enhancement
Milestone

Comments

@rstoyanchev
Copy link
Contributor

Currently WebMvcAutoConfiguration sets a PathPatternParser if the matching-strategy is PATH_PATTERN_PARSER but doesn't do anything if it is ANT_PATH_MATCHER since AntPathMatcher is used by the default.

After the changes in spring-projects/spring-framework#28607, parsed patterns are enabled by default, in Spring Framework 6.0, and that will require a review and likely some changes in the Boot auto-configuration to ensure the properties continue to work as expected.

First, it is now necessary to explicitly enable String path matching when it is needed. This can be done either by explicitly setting PathMatchConfigurer#patternParser to null. Second, technically a PathPatternParser does not need to be set externally in order to enable parsed patterns.

Do keep in mind, however, that if any AntPathMatcher related properties on PathMatchConfigurer are set, that could enable String path matching, if a PathPatternParser is not explicitly set. Generally, an application should not set the matching-strategy to PATH_PATTERN_PARSER and at the same time set AntPathMatcher related properties, as those are mutually exclusive. If both are set, then PathPatternParser takes precedence, but if only AntPathMatcher related properties are set then String path matching is enabled.

@rstoyanchev rstoyanchev changed the title Adapt to PathPatternParser default settings in Spring MVC Adapt to change in default strategy for URL path matching in Spring MVC Jun 29, 2022
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jun 29, 2022
@mbhave mbhave added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Jun 29, 2022
@mbhave mbhave added this to the 3.0.x milestone Jun 29, 2022
@EduColnago
Copy link

Can i try this one?

@wilkinsona
Copy link
Member

Thanks for the offer, @EduColnago. Unfortunately, we don't know exactly what needs to be done here. I think we'll need to do some investigation and design work before anyone can tackle it. I'll update the labels accordingly.

@wilkinsona wilkinsona added the status: pending-design-work Needs design work before any code can be developed label Jul 7, 2022
@mbhave mbhave self-assigned this Jul 8, 2022
@mbhave mbhave removed the status: pending-design-work Needs design work before any code can be developed label Jul 12, 2022
@mbhave mbhave closed this as completed in 7954f5e Jul 12, 2022
@mbhave mbhave modified the milestones: 3.0.x, 3.0.0-M4 Jul 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

5 participants