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
"IllegalArgumentException: Expected lookupPath in request attribute" in UrlPathHelper during MockMvc integration test (regression in 5.3.13 from 5.3.12?) #27715
Comments
In 5.3, Spring MVC supports 2 ways to match patterns and in Boot 2.6, parsed |
To expand on this, this is related to how you build the RequestMappingInfo's. It is necessary to set the options method on the builder to match how the That said, we can also help a bit since currently you need to prepare the options similar to what is done in |
This improves support for programmatic mapping registration following the same config as other mappings managed in RequestMappingHandlerMapping. See also issue spring-projects#27715.
@rstoyanchev Thank for that excellent analysis of the problem! I'm also impressed that you dived into my own code and found that I'm registering the mappings on my own! I really appreciate it! I've now implemented this in my own library following your suggestions. I've created a pull request #27723. I hope that was you had in mind! |
Thanks for the PR. That's indeed what I had in mind. I'm closing this one as superseded by it. |
My tests are failing with the same Error when I tried to upgrade from SpringBoot-2.3.8-Release to 2.4.13 However I am not building RequestMappingInfo and using RequestMappingHandlerMapping bean which is provided by org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration. My code simply does following method lookup in OncePerRequestFilter, |
@regggie I think your problem is related to: spring-projects/spring-boot#28874 (comment) While that comment applies to the new pattern matching infrastructure, the issue you're facing is the same but with the former infrastructure. Your filter is performing the matching process outside of its intended scope and is looking for a request attribute that has not been set. Please note that both Spring Boot 2.3.x and 2.4.x are out of OSS support and you should upgrade as soon as possible. See https://spring.io/projects/spring-boot#support |
@bclozel Thanks for pointing out the relevant issue. After setting below, |
Affects: 5.3.13
When I run this MockMvc integration test after upgrading from Spring Boot 2.5.6 to 2.6.0 (which upgrades Spring Framework from 5.2.12 to 5.3.13), I get the following stacktrace
The above linked integration test does nothing weird, only a simple request against an endpoint, essentially something like:
The only special thing I'm doing within those integration tests is that I have WebMvc AND WebFlux as a dependency at the same time.
Maybe that's a hint what might be causing this? I have no clue at the moment why that exception happens. When I revert to 5.2.12, the issue is gone and my test runs again.
Googling only brought up #26415 which seems unrelated.
Let me know if you need any further information.
The text was updated successfully, but these errors were encountered: