cloudevents / cloudevents/sdk-java

CloudEvents incompatiable with Spring-framework 7.x

Open
#704 4 comments 10 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
446
Forks
172
PR merge metrics
No merged PRs in 30d

Description

I know there is a similar issue up already about upgrading to Spring-boot 2.7.18 but this project has lagged so far behind now that you can't even launch it with using an up-to-date ecosystem since Spring Framework 7 introduced a breaking change:

HttpHeaders changes
The HttpHeaders API has been revisited in 7.0. This class no longer extends the MultiValueMap contract. Underlying servers treat headers more like a collection of pairs, and many map-like operations do not behave or perform well, because headers are case-insensitive in the first place. We therefore removed several methods as a result and introduced fallbacks as immediately @Deprecated, like HttpHeaders#asMultiValueMap. Please consider other methods as much as possible. See #33913 for more details.

Stacktrace you get when running latest release of cloudevent and you try to receive a message:
"Class org.springframework.http.HttpHeaders does not implement the requested interface java.util.Map","error.stack_trace":"java.lang.IncompatibleClassChangeError: Class org.springframework.http.HttpHeaders does not implement the requested interface java.util.Map\n\tat io.cloudevents.http.HttpMessageFactory.lambda$createReaderFromMultimap$5(HttpMessageFactory.java:112)\n\tat io.cloudevents.http.HttpMessageFactory.createReader(HttpMessageFactory.java:70)\n\tat io.cloudevents.http.HttpMessageFactory.createReaderFromMultimap(HttpMessageFactory.java:114)\n\tat io.cloudevents.spring.http.CloudEventHttpUtils.toReader(CloudEventHttpUtils.java:55)\n\tat io.cloudevents.spring.mvc.CloudEventHttpMessageConverter.readInternal(CloudEventHttpMessageConverter.java:54)\n\tat io.cloudevents.spring.mvc.CloudEventHttpMessageConverter.readInternal(CloudEventHttpMessageConverter.java:39)\n\tat org.springframework.http.converter.AbstractHttpMessageConverter.read(AbstractHttpMessageConverter.java:196)\n\tat

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at HttpMessageFactory.createReaderFromMultimap and CloudEventHttpUtils.toReader, the stack trace's failure path, and reproduce message receipt with Spring Framework 7. Trace the HttpHeaders handling through CloudEventHttpMessageConverter; done means receiving the message no longer raises IncompatibleClassChangeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.