Support Spring Framework 7 (Spring Boot 4) and Spring Cloud Gateway 5.x (#826)

* Support Spring Framework 7 (Spring Boot 4) and Spring Cloud Gateway 5.x

Spring Framework 7.0 dropped the MultiValueMap contract from HttpHeaders
(spring-projects/spring-framework gh-33913), removing List get(Object). The
webflux-6.x plugin was compiled against that overload, so every request through
DispatcherHandler#handle threw NoSuchMethodError before the entry span was
created: the service kept serving traffic but produced no traces at all.
spring-cloud-gateway-4.x shades a byte-identical copy of that interceptor and
its witness class still resolves on Spring Cloud Gateway 5.x, so gateway users
hit it through the documented plugin as well.

A bytecode sweep of every built plugin jar, resolving all org/springframework
constant-pool refs against spring-web/webflux 5.3.39, 6.2.0 and 7.0.5, found
only two Spring 7 removals reaching the agent, across three call sites.

- spring-webflux-6.x / -5.x: read the header via HttpHeaders#getFirst(String),
  which is declared on HttpHeaders itself in Spring 5, 6 and 7 with the same
  descriptor. Note HttpHeaders#get(String) does NOT work: compiled against
  Spring 6 javac still emits the (Object) descriptor. getOrEmpty is not
  cross-version safe either, its descriptor changes between 6 and 7.
- mvc-annotation-commons RequestUtil: use getValuesAsList(String). getFirst is
  wrong here because this site consumes every value. Note it additionally
  splits comma-delimited values.
- mvc-annotation-commons AbstractMethodInterceptor: drop the premature reactive
  status read. ServerHttpResponse#getRawStatusCode() was removed in Spring 7,
  and it ran before the response was written so it normally read null anyway.
  The version-specific InvokeInterceptor already sets http.status_code in
  Mono#doFinally, once the status is actually known.

Add Spring generation witnesses to both webflux plugins. The only guard was
WitnessMethod(Mono, contextWrite), which bounds Reactor and not Spring, which
is why the plugin attached to Spring 7 and then failed on every request rather
than cleanly not attaching. On Reactor 3.4 both Mono#subscriberContext and
Mono#contextWrite exist, so the 5.x and 6.x plugins would both match
DispatcherHandler#handle on Spring Boot 2.4-2.7.

Split the WebFlux application toolkit. Reactor removed Signal#getContext() in
3.5.0 and ContextView does not exist before 3.4.0, so no single artifact can
serve both; continueTracing has been broken on all of Spring Boot 3 and 4 since
Nov 2022. apm-toolkit-webflux becomes apm-toolkit-webflux-5.x (package
...toolkit.webflux.v5, unchanged behaviour) and a new apm-toolkit-webflux-6.x
(package ...toolkit.webflux.v6) compiles against Reactor 3.5 and uses
Signal#getContextView(). Compiling forward is deliberate: the module rotted
silently for three years because it compiled against the oldest Reactor, so
javac never flagged the removal. Distinct packages make picking the wrong
artifact a compile error rather than a runtime NoSuchMethodError. The
activation keeps matching the legacy un-versioned names, so applications that
never upgrade their toolkit still work against a newer agent.

No plugin, framework version or Reactor version loses support.

Add webflux-6.x-7.x-scenario (Spring Boot 3.0 -> 4.1, one version per minor)
and gateway-5.x-scenario (Spring Cloud Gateway 5.0.3 on Spring Boot 4). Both
drive a full round-trip so the cross-process ref is asserted, which is the only
thing that proves the sw8 header is read back correctly.

Closes apache/skywalking#14047
48 files changed
tree: 6661d70fbb0453ddf07299aaf7a4d507bece77b4
  1. .claude/
  2. .github/
  3. .mvn/
  4. apm-application-toolkit/
  5. apm-checkstyle/
  6. apm-commons/
  7. apm-protocol/
  8. apm-sniffer/
  9. changes/
  10. dist-material/
  11. docs/
  12. test/
  13. tools/
  14. .asf.yaml
  15. .dlc.json
  16. .dockerignore
  17. .gitignore
  18. .gitmodules
  19. .licenserc.yaml
  20. CHANGES.md
  21. CLAUDE.md
  22. codeStyle.xml
  23. CONTRIBUTING.md
  24. Dockerfile
  25. HEADER
  26. LICENSE
  27. lombok.config
  28. Makefile
  29. mvnw
  30. mvnw.cmd
  31. NOTICE
  32. pom.xml
  33. README.md
README.md

Apache SkyWalking Java Agent

GitHub stars Twitter Follow

Maven Central CI

SkyWalking-Java: The Java Agent for Apache SkyWalking, which provides the native tracing/metrics/logging abilities for Java projects.

SkyWalking: an APM(application performance monitor) system, especially designed for microservices, cloud native and container-based (Docker and Kubernetes) architectures.

Documentation

Downloads

Please head to the releases page to download a release of Apache SkyWalking.

Code of conduct

This project adheres to the Contributor Covenant code of conduct. By participating, you are expected to uphold this code. Please follow the REPORTING GUIDELINES to report unacceptable behavior.

Live Demo

Find the demo and screenshots on our website.

Contact Us

  • Mail list: dev@skywalking.apache.org. Mail to dev-subscribe@skywalking.apache.org, follow the reply to subscribe the mail list.
  • Send Request to join SkyWalking slack mail to the mail list(dev@skywalking.apache.org), we will invite you in.
  • For Chinese speaker, send [CN] Request to join SkyWalking slack mail to the mail list(dev@skywalking.apache.org), we will invite you in.
  • Twitter, ASFSkyWalking
  • bilibili B站 视频

License

Apache 2.0 License.