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

WebFlux.fn puts wrong type of HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE [SPR-17395] #21928

Closed
spring-issuemaster opened this issue Oct 17, 2018 · 3 comments
Assignees
Milestone

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Oct 17, 2018

Toshiaki Maki opened SPR-17395 and commented

#21635 introduced RouterFunctions.MATCHING_PATTERN_ATTRIBUTE to WebFlux.fn, and set that mapping information as a String. #21900 duplicated that same information in HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE with the same type, whereas it is expected to be of type PathPattern,

attributes.put(BEST_MATCHING_HANDLER_ATTRIBUTE, handlerFunction);
String matchingPattern =
(String) attributes.get(RouterFunctions.MATCHING_PATTERN_ATTRIBUTE);
if (matchingPattern != null) {
attributes.put(BEST_MATCHING_PATTERN_ATTRIBUTE, matchingPattern);

As a result, ClassCastException occurs after updating to Spring Boot 2.1.0.RC1 as Boot expects it as PathPattern

https://github.com/spring-projects/spring-boot/blob/v2.1.0.RC1/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server/WebFluxTags.java#L97-L98


Affects: 5.1.1

Issue Links:

  • #21635 Provide matched pattern information in WebFlux fn
  • #21900 Set BEST_MATCHING_HANDLER_ATTRIBUTE in WebFlux.fn
@spring-issuemaster
Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Oct 17, 2018

Juergen Hoeller commented

Either we need to put a PathPattern there, or Boot needs to assume a String... Either way, this needs to be clarified for Spring Framework 5.1.2 / Boot 2.1 GA.

@spring-issuemaster
Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Oct 17, 2018

Rossen Stoyanchev commented

The Javadoc only says "the best matching pattern" but should have say to expect PathPattern since that's what's in use in WebFlux and that's what was actually being set for annotated controllers since 5.0. So to let's make it official in the Javadoc and set to PathPattern consistently.

@spring-issuemaster
Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Oct 18, 2018

Arjen Poutsma commented

Fixed in d303c8a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.