fix(webflux): fix NoSuchMethodError when using spring framework 7 with webflux#4515
fix(webflux): fix NoSuchMethodError when using spring framework 7 with webflux#4515jihad-bouhaiji wants to merge 5 commits into
Conversation
🤖 GitHub commentsJust comment with:
|
SylvainJuge
left a comment
There was a problem hiding this comment.
Can you try to add an explicit test that allows to reproduce it ? Is the issue happening with the version that is being used for compilation ? if yes, then a simple unit test should be enough. If not, then do you have a sample application that allows to reproduce the issue ?
| // This is the only way I could find to make a multiValueMap without having access | ||
| // to the api from spring framework 7 that will work across versions 5, 6 and 7 |
There was a problem hiding this comment.
[nit] reword the comment to explain the "why".
| // This is the only way I could find to make a multiValueMap without having access | |
| // to the api from spring framework 7 that will work across versions 5, 6 and 7 | |
| // This allows to to make a MultiValueMap without having access | |
| // to the api from spring framework 7 that will work across versions 5, 6 and 7 |
| // This is the only way I could find to make a multiValueMap without having access | ||
| // to the api from spring framework 7 that will work across versions 5, 6 and 7 | ||
| Map<String, List<String>> multiValueHeaderMap = source.toSingleValueMap().keySet() | ||
| .parallelStream().collect(Collectors.toMap(Function.identity(), new Function<>() { |
There was a problem hiding this comment.
[minor] we don't need a parallelStream here as only a few values are expected, so it is probably better to use the non parallel one.
|
I added a module I do have a question. |
What does this PR do?
This PR fixes an issue with the experimental support for Spring framework 7 that was added PR. When running the agent, it will throw a NoSuchMethodError exception due to the
HttpHeaders.entrySetmethod. This is due to HttpHeaders no longer implementing the MultiValueMap contract.I have changed the copying of header to only use API's that are still available across version 5, 6 and 7.
The test
co.elastic.apm.agent.springwebflux.AbstractServerInstrumentationTest#dispatchHellocovers this fix.Checklist