From bfcc8eedd7d3974cf13edfd352aa0fe80bf1ee1b Mon Sep 17 00:00:00 2001 From: Nicklas Wallgren Date: Fri, 24 Nov 2023 11:54:23 +0100 Subject: [PATCH] #3439 - Handle removal of ClientResponse#rawStatusCode and bump to Spring Boot 3.2 --- .../elastic/apm/agent/springwebclient/WebClientSubscriber.java | 2 +- .../apm/agent/springwebflux/testapp/GreetingWebClient.java | 2 +- apm-agent-plugins/apm-spring-webflux/pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webclient-plugin/src/main/java/co/elastic/apm/agent/springwebclient/WebClientSubscriber.java b/apm-agent-plugins/apm-spring-webflux/apm-spring-webclient-plugin/src/main/java/co/elastic/apm/agent/springwebclient/WebClientSubscriber.java index e86d0c750e5..82c7bd5459d 100755 --- a/apm-agent-plugins/apm-spring-webflux/apm-spring-webclient-plugin/src/main/java/co/elastic/apm/agent/springwebclient/WebClientSubscriber.java +++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webclient-plugin/src/main/java/co/elastic/apm/agent/springwebclient/WebClientSubscriber.java @@ -74,7 +74,7 @@ public void onNext(T t) { try { if (span != null && t instanceof ClientResponse) { ClientResponse clientResponse = (ClientResponse) t; - int statusCode = clientResponse.rawStatusCode(); + int statusCode = clientResponse.statusCode().value(); span.withOutcome(ResultUtil.getOutcomeByHttpClientStatus(statusCode)); span.getContext().getHttp().withStatusCode(statusCode); } diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-testapp/src/main/java/co/elastic/apm/agent/springwebflux/testapp/GreetingWebClient.java b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-testapp/src/main/java/co/elastic/apm/agent/springwebflux/testapp/GreetingWebClient.java index 49778ccbe8d..ce04c80741a 100644 --- a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-testapp/src/main/java/co/elastic/apm/agent/springwebflux/testapp/GreetingWebClient.java +++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-testapp/src/main/java/co/elastic/apm/agent/springwebflux/testapp/GreetingWebClient.java @@ -222,7 +222,7 @@ private WebClient.ResponseSpec request(String method, Function .headers(httpHeaders -> httpHeaders.addAll(headers)) .cookies(httpCookies -> httpCookies.addAll(cookies)) .retrieve() - .onRawStatus(status -> status != expectedStatus, r -> Mono.error(new IllegalStateException(String.format("unexpected response status %d", r.rawStatusCode())))); + .onRawStatus(status -> status != expectedStatus, r -> Mono.error(new IllegalStateException(String.format("unexpected response status %d", r.statusCode().value())))); } @Override diff --git a/apm-agent-plugins/apm-spring-webflux/pom.xml b/apm-agent-plugins/apm-spring-webflux/pom.xml index a8c08366da6..34abfc9b723 100644 --- a/apm-agent-plugins/apm-spring-webflux/pom.xml +++ b/apm-agent-plugins/apm-spring-webflux/pom.xml @@ -18,7 +18,7 @@ 2.7.16 - 3.1.5 + 3.2.0