-
Notifications
You must be signed in to change notification settings - Fork 40.8k
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
Clarify that MVC components provided through WebMvcRegistrations are subject to subsequent processing and configuration by MVC #31232
Comments
Thanks for the report and, in particular, the MCVE.
In short, your |
Thanks for taking a look at this. I don't recall where the idea to use What I probably failed to emphasize a bit better in the opening comment is that the behavior of the |
This would have to be addressed in Framework. This difference in behaviour is due to different logic in Framework being applied depending on whether or not a pattern parser has been configured. For example, when a pattern parser has been configured, I can certainly see how the difference in behavior of the two different matching strategies is confusing. I'll raise this with the Framework team as I want to be sure that the documentation changes I'm proposing above are aligned with the intent in MVC. |
OK, thanks. I suspected if a change was to be made it would be in Framework but it's good to also have additional clarifications in Boot's docs. |
Note that |
Exactly, but the issue is that you then end up in an inconsistent state, where IMO at the very least (if no changes in behavior are to be made) Framework could override Again, the problem is that the |
Can we support Line 411 in 47da706
|
I agree that the current situation is a bit strange. The For 6.0, I am proposing to use |
Previously, I was able to disable Spring MVC's trailing slash matching using something like this:
This doesn't work any more since
2.6.0
and the change of behavior appears to be related to introduction ofPathPatternParser
as the default path matching strategy.I've put together a reproduced in https://github.com/vpavic/mcve-spring-mvc-trailing-slash.
By default, trailing slash matching is enabled and
curl -sv -u user:password http://localhost:8080/resources/
(note the trailing slash) returns200
response. There are two profiles that disable trailing slash matching -configurer
andregistrations
. The former usesWebMvcConfigurer
based approach and this works (meaning, cURL request returns404
), while the latter usesWebMvcRegistrations
based approach (as in the snippet above) and this doesn't work (returns200
).Downgrading Spring Boot to
2.5.x
makes theregistrations
profile work as expected.I'm reporting this here for starters because what's failing is a Spring Boot specific configuration mechanism (
WebMvcRegistrations
) even though it seems to me that the fix might very well be needed in the Framework.The text was updated successfully, but these errors were encountered: