diff --git a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/Java17OnlyTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/testutils/Java17OnlyTest.java
similarity index 98%
rename from apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/Java17OnlyTest.java
rename to apm-agent-core/src/test/java/co/elastic/apm/agent/testutils/Java17OnlyTest.java
index b55168b1ef..f681030f00 100644
--- a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/Java17OnlyTest.java
+++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/testutils/Java17OnlyTest.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package co.elastic.apm.agent.springwebmvc;
+package co.elastic.apm.agent.testutils;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledForJreRange;
diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webclient-plugin/pom.xml b/apm-agent-plugins/apm-spring-webflux/apm-spring-webclient-plugin/pom.xml
index a2dc73bb75..ec8773806d 100755
--- a/apm-agent-plugins/apm-spring-webflux/apm-spring-webclient-plugin/pom.xml
+++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webclient-plugin/pom.xml
@@ -20,6 +20,18 @@
true
+
+
+
+ org.springframework.boot
+ spring-boot-dependencies
+ ${version.spring-boot-3}
+ pom
+ import
+
+
+
+
co.elastic.apm
@@ -29,13 +41,23 @@
org.springframework
spring-web
- ${version.spring}
provided
+
+
+
+ org.springframework
+ spring-jcl
+
+
org.springframework
spring-webflux
- ${version.spring}
provided
@@ -51,27 +73,40 @@
io.projectreactor.netty
reactor-netty-http
- 1.0.7
+ test
+
+
+ io.netty
+ netty-resolver-dns-native-macos
+ osx-aarch_64
test
org.eclipse.jetty
jetty-reactive-httpclient
- 1.1.11
test
org.apache.httpcomponents.client5
httpclient5
- 5.1.3
test
org.apache.httpcomponents.core5
httpcore5-reactive
- 5.1.3
+ test
+
+
+ org.apache.ivy
+ ivy
+ test
+
+
+ commons-logging
+ commons-logging
+ 1.2
test
diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webclient-plugin/src/test/java/co/elastic/apm/agent/springwebclient/WebClientInstrumentationIT.java b/apm-agent-plugins/apm-spring-webflux/apm-spring-webclient-plugin/src/test/java/co/elastic/apm/agent/springwebclient/WebClientInstrumentationIT.java
new file mode 100644
index 0000000000..2a2fd670f1
--- /dev/null
+++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webclient-plugin/src/test/java/co/elastic/apm/agent/springwebclient/WebClientInstrumentationIT.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package co.elastic.apm.agent.springwebclient;
+
+import co.elastic.apm.agent.httpclient.AbstractHttpClientInstrumentationTest;
+import co.elastic.apm.agent.testutils.JUnit4TestClassWithDependencyRunner;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.ValueSource;
+import org.springframework.http.client.reactive.ReactorClientHttpConnector;
+import org.springframework.web.reactive.function.client.WebClient;
+import reactor.netty.http.client.HttpClient;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class WebClientInstrumentationIT {
+
+
+ @ParameterizedTest
+ @ValueSource(strings = {"5.3.26"})
+ public void testNetty(String springVersion) throws Exception {
+ List dependencies = Arrays.asList(
+ "org.springframework:spring-web:" + springVersion,
+ "org.springframework:spring-webflux:" + springVersion,
+ "org.springframework:spring-core:" + springVersion,
+ "org.springframework:spring-beans:" + springVersion
+ );
+ JUnit4TestClassWithDependencyRunner runner = new JUnit4TestClassWithDependencyRunner(dependencies, WebClientInstrumentationIT.class.getName() + "$TestImpl", WebClientInstrumentationIT.class.getName());
+ runner.run();
+ }
+
+ /**
+ * We don't test with all variations of {@link WebClientInstrumentationTest}
+ * but just with netty for integration test.
+ */
+ public static class TestImpl extends AbstractHttpClientInstrumentationTest {
+
+ private final WebClient webClient;
+
+
+ public TestImpl() {
+ HttpClient httpClient = HttpClient.create()
+ // followRedirect(boolean) only enables redirect for 30[1278], not 303
+ .followRedirect((req, res) -> res.status().code() == 303);
+
+ // crete netty reactor client
+ webClient = WebClient.builder()
+ .clientConnector(new ReactorClientHttpConnector(httpClient))
+ .build();
+ }
+
+ @Override
+ public boolean isRequireCheckErrorWhenCircularRedirect() {
+ // circular redirect does not trigger an error to capture with netty
+ return false;
+ }
+
+ @Override
+ public boolean isTestHttpCallWithUserInfoEnabled() {
+ // user info URI does not work with netty
+ return false;
+ }
+
+
+ @Override
+ protected void performGet(String path) throws Exception {
+ webClient.get().uri(path).exchangeToMono(response -> response.bodyToMono(String.class)).block();
+ }
+ }
+}
diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webclient-plugin/src/test/java/co/elastic/apm/agent/springwebclient/WebClientInstrumentationTest.java b/apm-agent-plugins/apm-spring-webflux/apm-spring-webclient-plugin/src/test/java/co/elastic/apm/agent/springwebclient/WebClientInstrumentationTest.java
index eae3e9b497..006f673732 100644
--- a/apm-agent-plugins/apm-spring-webflux/apm-spring-webclient-plugin/src/test/java/co/elastic/apm/agent/springwebclient/WebClientInstrumentationTest.java
+++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webclient-plugin/src/test/java/co/elastic/apm/agent/springwebclient/WebClientInstrumentationTest.java
@@ -18,6 +18,7 @@
*/
package co.elastic.apm.agent.springwebclient;
+import co.elastic.apm.agent.common.JvmRuntimeInfo;
import co.elastic.apm.agent.httpclient.AbstractHttpClientInstrumentationTest;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -30,13 +31,16 @@
@RunWith(Parameterized.class)
public class WebClientInstrumentationTest extends AbstractHttpClientInstrumentationTest {
- private final WebClient webClient;
+ /**
+ * Can't directly reference WebClient because it is compiled with java 17.
+ */
+ private final Object webClient;
private final RequestStrategy strategy;
private final boolean isNetty;
- public WebClientInstrumentationTest(String clientIgnored, WebClient webClient, RequestStrategy strategy, boolean isNetty) {
+ public WebClientInstrumentationTest(String clientIgnored, Object webClient, RequestStrategy strategy, boolean isNetty) {
this.webClient = webClient;
this.strategy = strategy;
this.isNetty = isNetty;
@@ -44,20 +48,24 @@ public WebClientInstrumentationTest(String clientIgnored, WebClient webClient, R
@Parameterized.Parameters(name = "client = {0}, request strategy = {2}")
public static Object[][] testParams() {
- return new Object[][]{
- {"jetty", jettyClient(), RequestStrategy.EXCHANGE, false},
- {"jetty", jettyClient(), RequestStrategy.EXCHANGE_TO_FLUX, false},
- {"jetty", jettyClient(), RequestStrategy.EXCHANGE_TO_MONO, false},
- {"jetty", jettyClient(), RequestStrategy.RETRIEVE, false},
- {"netty", nettyClient(), RequestStrategy.EXCHANGE, true},
- {"netty", nettyClient(), RequestStrategy.EXCHANGE_TO_FLUX, true},
- {"netty", nettyClient(), RequestStrategy.EXCHANGE_TO_MONO, true},
- {"netty", nettyClient(), RequestStrategy.RETRIEVE, true},
- {"hc5", reactiveHttpClient5(), RequestStrategy.EXCHANGE, false},
- {"hc5", reactiveHttpClient5(), RequestStrategy.EXCHANGE_TO_FLUX, false},
- {"hc5", reactiveHttpClient5(), RequestStrategy.EXCHANGE_TO_MONO, false},
- {"hc5", reactiveHttpClient5(), RequestStrategy.RETRIEVE, false}
- };
+ if (JvmRuntimeInfo.ofCurrentVM().getMajorVersion() >= 17) {
+ return new Object[][]{
+ {"jetty", Clients.jettyClient(), RequestStrategy.EXCHANGE, false},
+ {"jetty", Clients.jettyClient(), RequestStrategy.EXCHANGE_TO_FLUX, false},
+ {"jetty", Clients.jettyClient(), RequestStrategy.EXCHANGE_TO_MONO, false},
+ {"jetty", Clients.jettyClient(), RequestStrategy.RETRIEVE, false},
+ {"netty", Clients.nettyClient(), RequestStrategy.EXCHANGE, true},
+ {"netty", Clients.nettyClient(), RequestStrategy.EXCHANGE_TO_FLUX, true},
+ {"netty", Clients.nettyClient(), RequestStrategy.EXCHANGE_TO_MONO, true},
+ {"netty", Clients.nettyClient(), RequestStrategy.RETRIEVE, true},
+ {"hc5", Clients.reactiveHttpClient5(), RequestStrategy.EXCHANGE, false},
+ {"hc5", Clients.reactiveHttpClient5(), RequestStrategy.EXCHANGE_TO_FLUX, false},
+ {"hc5", Clients.reactiveHttpClient5(), RequestStrategy.EXCHANGE_TO_MONO, false},
+ {"hc5", Clients.reactiveHttpClient5(), RequestStrategy.RETRIEVE, false}
+ };
+ } else {
+ return new Object[0][0];
+ }
}
@Override
@@ -86,55 +94,58 @@ protected enum RequestStrategy {
EXCHANGE {
@Override
@SuppressWarnings("deprecation")
- void execute(WebClient client, String uri) {
- client.get().uri(uri).exchange() // deprecated API
+ void execute(Object client, String uri) {
+ ((WebClient) client).get().uri(uri).exchange() // deprecated API
.block();
}
},
EXCHANGE_TO_FLUX {
@Override
- void execute(WebClient client, String uri) {
- client.get().uri(uri).exchangeToFlux(response -> response.bodyToFlux(String.class)).blockLast();
+ void execute(Object client, String uri) {
+ ((WebClient) client).get().uri(uri).exchangeToFlux(response -> response.bodyToFlux(String.class)).blockLast();
}
},
EXCHANGE_TO_MONO {
// TODO
@Override
- void execute(WebClient client, String uri) {
- client.get().uri(uri).exchangeToMono(response -> response.bodyToMono(String.class)).block();
+ void execute(Object client, String uri) {
+ ((WebClient) client).get().uri(uri).exchangeToMono(response -> response.bodyToMono(String.class)).block();
}
},
RETRIEVE {
@Override
- void execute(WebClient client, String uri) {
- client.get().uri(uri).retrieve().bodyToMono(String.class).block();
+ void execute(Object client, String uri) {
+ ((WebClient) client).get().uri(uri).retrieve().bodyToMono(String.class).block();
}
};
- abstract void execute(WebClient client, String uri);
- }
-
- private static WebClient jettyClient() {
- return WebClient.builder()
- .clientConnector(new JettyClientHttpConnector())
- .build();
- }
-
- private static WebClient nettyClient() {
- HttpClient httpClient = HttpClient.create()
- // followRedirect(boolean) only enables redirect for 30[1278], not 303
- .followRedirect((req, res) -> res.status().code() == 303);
-
- // crete netty reactor client
- return WebClient.builder()
- .clientConnector(new ReactorClientHttpConnector(httpClient))
- .build();
+ abstract void execute(Object client, String uri);
}
- public static WebClient reactiveHttpClient5() {
- return WebClient.builder()
- .clientConnector(new HttpComponentsClientHttpConnector())
- .build();
+ public static class Clients {
+
+ private static Object jettyClient() {
+ return WebClient.builder()
+ .clientConnector(new JettyClientHttpConnector())
+ .build();
+ }
+
+ private static Object nettyClient() {
+ HttpClient httpClient = HttpClient.create()
+ // followRedirect(boolean) only enables redirect for 30[1278], not 303
+ .followRedirect((req, res) -> res.status().code() == 303);
+
+ // crete netty reactor client
+ return WebClient.builder()
+ .clientConnector(new ReactorClientHttpConnector(httpClient))
+ .build();
+ }
+
+ public static Object reactiveHttpClient5() {
+ return WebClient.builder()
+ .clientConnector(new HttpComponentsClientHttpConnector())
+ .build();
+ }
}
}
diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-plugin/pom.xml b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-plugin/pom.xml
index ecdcd8b004..ae520890ea 100644
--- a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-plugin/pom.xml
+++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-plugin/pom.xml
@@ -21,9 +21,9 @@
- org.springframework
- spring-framework-bom
- 6.0.1
+ org.springframework.boot
+ spring-boot-dependencies
+ ${version.spring-boot-3}
pom
import
@@ -36,6 +36,14 @@
apm-spring-webflux-spring5
${project.version}
+
+
+
+ ${project.groupId}
+ apm-spring-webflux-testapp
+ ${project.version}
+ test
+
org.springframework
spring-web
@@ -44,9 +52,31 @@
io.projectreactor
reactor-test
- ${version.reactor}
test
+
+ co.elastic.apm
+ apm-spring-webflux-spring5
+ ${project.version}
+ test
+ test-jar
+
+
+
+
+ co.elastic.apm
+ apm-reactor-plugin
+ ${project.version}
+ test
+
+
+
+ co.elastic.apm
+ apm-reactor-plugin
+ ${project.version}
+ test
+ test-jar
+
diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-plugin/src/test/java/co/elastic/apm/agent/springwebflux/Spring6HeaderGetterTest.java b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-plugin/src/test/java/co/elastic/apm/agent/springwebflux/Spring6HeaderGetterTest.java
new file mode 100644
index 0000000000..ab65a7d8eb
--- /dev/null
+++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-plugin/src/test/java/co/elastic/apm/agent/springwebflux/Spring6HeaderGetterTest.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package co.elastic.apm.agent.springwebflux;
+
+import co.elastic.apm.agent.testutils.Java17OnlyTest;
+import org.junit.jupiter.api.condition.EnabledForJreRange;
+import org.junit.jupiter.api.condition.JRE;
+
+@EnabledForJreRange(min = JRE.JAVA_17)
+public class Spring6HeaderGetterTest extends Java17OnlyTest {
+
+ public Spring6HeaderGetterTest() {
+ super(Impl.class);
+ }
+
+ public static class Impl extends HeaderGetterTest {
+
+ }
+}
diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-plugin/src/test/java/co/elastic/apm/agent/springwebflux/Spring6ServerAnnotatedInstrumentationTest.java b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-plugin/src/test/java/co/elastic/apm/agent/springwebflux/Spring6ServerAnnotatedInstrumentationTest.java
new file mode 100644
index 0000000000..b30ca5b06f
--- /dev/null
+++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-plugin/src/test/java/co/elastic/apm/agent/springwebflux/Spring6ServerAnnotatedInstrumentationTest.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package co.elastic.apm.agent.springwebflux;
+
+import co.elastic.apm.agent.testutils.Java17OnlyTest;
+
+public class Spring6ServerAnnotatedInstrumentationTest extends Java17OnlyTest {
+
+ public Spring6ServerAnnotatedInstrumentationTest() {
+ super(Impl.class);
+ }
+
+ public static class Impl extends ServerAnnotatedInstrumentationTest {
+ }
+}
diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-plugin/src/test/java/co/elastic/apm/agent/springwebflux/Spring6ServerFunctionalInstrumentationTest.java b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-plugin/src/test/java/co/elastic/apm/agent/springwebflux/Spring6ServerFunctionalInstrumentationTest.java
new file mode 100644
index 0000000000..c593194b20
--- /dev/null
+++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-plugin/src/test/java/co/elastic/apm/agent/springwebflux/Spring6ServerFunctionalInstrumentationTest.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package co.elastic.apm.agent.springwebflux;
+
+import co.elastic.apm.agent.testutils.Java17OnlyTest;
+
+public class Spring6ServerFunctionalInstrumentationTest extends Java17OnlyTest {
+
+ public Spring6ServerFunctionalInstrumentationTest() {
+ super(Impl.class);
+ }
+
+ public static class Impl extends ServerFunctionalInstrumentationTest {
+ }
+}
diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-plugin/src/test/java/co/elastic/apm/agent/springwebflux/Spring6ServletContainerTest.java b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-plugin/src/test/java/co/elastic/apm/agent/springwebflux/Spring6ServletContainerTest.java
new file mode 100644
index 0000000000..a62c7a2e4b
--- /dev/null
+++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-plugin/src/test/java/co/elastic/apm/agent/springwebflux/Spring6ServletContainerTest.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package co.elastic.apm.agent.springwebflux;
+
+import org.junit.jupiter.api.condition.EnabledForJreRange;
+import org.junit.jupiter.api.condition.JRE;
+
+@EnabledForJreRange(min = JRE.JAVA_17)
+public class Spring6ServletContainerTest extends ServletContainerTest {
+}
diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-plugin/src/test/java/co/elastic/apm/agent/springwebflux/Spring6WebSocketServerInstrumentationTest.java b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-plugin/src/test/java/co/elastic/apm/agent/springwebflux/Spring6WebSocketServerInstrumentationTest.java
new file mode 100644
index 0000000000..db43911d06
--- /dev/null
+++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-plugin/src/test/java/co/elastic/apm/agent/springwebflux/Spring6WebSocketServerInstrumentationTest.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package co.elastic.apm.agent.springwebflux;
+
+import org.junit.jupiter.api.condition.EnabledForJreRange;
+import org.junit.jupiter.api.condition.JRE;
+
+@EnabledForJreRange(min = JRE.JAVA_17)
+public class Spring6WebSocketServerInstrumentationTest extends WebSocketServerInstrumentationTest {
+}
diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-spring5/pom.xml b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-spring5/pom.xml
index 7438336d4e..cb89142a9a 100644
--- a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-spring5/pom.xml
+++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-spring5/pom.xml
@@ -21,9 +21,9 @@
- org.springframework
- spring-framework-bom
- 5.3.25
+ org.springframework.boot
+ spring-boot-dependencies
+ ${version.spring-boot-2}
pom
import
@@ -31,6 +31,12 @@
+
+ ${project.groupId}
+ apm-httpserver-core
+ ${project.version}
+
+
org.springframework
spring-web
@@ -50,11 +56,6 @@
test
-
- ${project.groupId}
- apm-httpserver-core
- ${project.version}
-
@@ -72,14 +73,6 @@
test-jar
-
-
- co.elastic.apm
- apm-servlet-plugin
- ${project.version}
- test
-
-
org.springframework
spring-test
@@ -89,10 +82,22 @@
io.projectreactor
reactor-test
- ${version.reactor}
test
-
+
+
+
+ maven-jar-plugin
+
+
+
+ test-jar
+
+
+
+
+
+
diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-spring5/src/test/java/co/elastic/apm/agent/springwebflux/SpringWeb5UtilsTest.java b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-spring5/src/test/java/co/elastic/apm/agent/springwebflux/SpringWeb5UtilsTest.java
new file mode 100644
index 0000000000..f0fb189b42
--- /dev/null
+++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-spring5/src/test/java/co/elastic/apm/agent/springwebflux/SpringWeb5UtilsTest.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package co.elastic.apm.agent.springwebflux;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.server.reactive.ServerHttpResponse;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+
+class SpringWeb5UtilsTest {
+
+ @Test
+ void testGetStatusCode() throws Exception {
+ ServerHttpResponse mockResponse = mock(ServerHttpResponse.class);
+ doReturn(HttpStatus.IM_USED).when(mockResponse).getStatusCode();
+ assertThat(SpringWebVersionUtils.getStatusCode(mockResponse)).isEqualTo(226);
+ }
+
+ @Test
+ void testWrongResponseType() {
+ assertThatThrownBy(() -> SpringWebVersionUtils.getStatusCode(new Object())).isInstanceOf(ClassCastException.class);
+ }
+}
diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-testapp/pom.xml b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-testapp/pom.xml
index c43b22d389..2b6413c945 100644
--- a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-testapp/pom.xml
+++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-testapp/pom.xml
@@ -29,14 +29,7 @@
org.springframework.boot
spring-boot-dependencies
- ${version.spring-boot}
- pom
- import
-
-
- com.fasterxml.jackson
- jackson-bom
- ${version.jackson}
+ ${version.spring-boot-2}
pom
import
@@ -76,48 +69,24 @@
com.fasterxml.jackson.core
jackson-databind
- compile
+
+
+ org.slf4j
+ slf4j-simple
org.springframework.boot
spring-boot-starter-test
test
-
-
-
- org.junit.jupiter
- junit-jupiter
-
-
- org.junit.vintage
- junit-vintage-engine
-
-
io.projectreactor
reactor-test
- ${version.reactor}
- test
-
-
-
-
- org.junit.platform
- junit-platform-commons
- 1.7.0
test
-
- org.slf4j
- slf4j-simple
- ${version.slf4j}
-
-
diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-testapp/src/main/java/co/elastic/apm/agent/springwebflux/testapp/GreetingHandler.java b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-testapp/src/main/java/co/elastic/apm/agent/springwebflux/testapp/GreetingHandler.java
index a35bb9cc64..4222b836fd 100644
--- a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-testapp/src/main/java/co/elastic/apm/agent/springwebflux/testapp/GreetingHandler.java
+++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-testapp/src/main/java/co/elastic/apm/agent/springwebflux/testapp/GreetingHandler.java
@@ -37,7 +37,7 @@
@Component
public class GreetingHandler {
- public static final Scheduler CHILDREN_SCHEDULER = Schedulers.newElastic("children");
+ public static final Scheduler CHILDREN_SCHEDULER = Schedulers.newBoundedElastic(16, 128, "children");
public Mono helloMessage(@Nullable String name) {
return Mono.just(String.format("Hello, %s!", Optional.ofNullable(name).orElse("Spring")));
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 236f91212a..49778ccbe8 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
@@ -77,7 +77,7 @@ public GreetingWebClient(String host, int port, boolean useFunctionalEndpoint, b
this.useFunctionalEndpoint = useFunctionalEndpoint;
this.headers = new HttpHeaders();
this.cookies = new HttpHeaders();
- this.clientScheduler = Schedulers.newElastic("webflux-client");
+ this.clientScheduler = Schedulers.newBoundedElastic(16, 128, "webflux-client");
this.wsClient = new ReactorNettyWebSocketClient();
this.logEnabled = logEnabled;
}
diff --git a/apm-agent-plugins/apm-spring-webflux/pom.xml b/apm-agent-plugins/apm-spring-webflux/pom.xml
index a825a65add..921c0d727b 100644
--- a/apm-agent-plugins/apm-spring-webflux/pom.xml
+++ b/apm-agent-plugins/apm-spring-webflux/pom.xml
@@ -16,15 +16,9 @@
${project.basedir}/../..
-
- 2.5.3
-
-
- 5.3.10
- 3.4.18
-
-
- 2.12.4
+
+ 2.7.10
+ 3.0.5
@@ -33,4 +27,15 @@
apm-spring-webflux-testapp
apm-spring-webflux-spring5
+
+
+
+
+
+ co.elastic.apm
+ apm-servlet-plugin
+ ${project.version}
+ test
+
+
diff --git a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/Spring6TransactionNameInstrumentationTest.java b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/Spring6TransactionNameInstrumentationTest.java
index e8831be9b4..91f5e09511 100644
--- a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/Spring6TransactionNameInstrumentationTest.java
+++ b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/Spring6TransactionNameInstrumentationTest.java
@@ -18,6 +18,7 @@
*/
package co.elastic.apm.agent.springwebmvc;
+import co.elastic.apm.agent.testutils.Java17OnlyTest;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
diff --git a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/exception/Spring6ExceptionHandlerInstrumentationWithExceptionHandlerTest.java b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/exception/Spring6ExceptionHandlerInstrumentationWithExceptionHandlerTest.java
index ee1c5e3bdc..2d6f8a0c35 100644
--- a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/exception/Spring6ExceptionHandlerInstrumentationWithExceptionHandlerTest.java
+++ b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/exception/Spring6ExceptionHandlerInstrumentationWithExceptionHandlerTest.java
@@ -18,7 +18,7 @@
*/
package co.elastic.apm.agent.springwebmvc.exception;
-import co.elastic.apm.agent.springwebmvc.Java17OnlyTest;
+import co.elastic.apm.agent.testutils.Java17OnlyTest;
public class Spring6ExceptionHandlerInstrumentationWithExceptionHandlerTest extends Java17OnlyTest {
diff --git a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/exception/Spring6ExceptionHandlerInstrumentationWithExceptionResolverTest.java b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/exception/Spring6ExceptionHandlerInstrumentationWithExceptionResolverTest.java
index a2743c3db9..f56cf5e5aa 100644
--- a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/exception/Spring6ExceptionHandlerInstrumentationWithExceptionResolverTest.java
+++ b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/exception/Spring6ExceptionHandlerInstrumentationWithExceptionResolverTest.java
@@ -18,8 +18,8 @@
*/
package co.elastic.apm.agent.springwebmvc.exception;
-import co.elastic.apm.agent.springwebmvc.Java17OnlyTest;
import co.elastic.apm.agent.springwebmvc.exception.testapp.exception_resolver.AbstractRestResponseStatusExceptionResolver;
+import co.elastic.apm.agent.testutils.Java17OnlyTest;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Component;
diff --git a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/exception/Spring6ExceptionHandlerInstrumentationWithGlobalAdviceTest.java b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/exception/Spring6ExceptionHandlerInstrumentationWithGlobalAdviceTest.java
index f6e7e9b9fb..5567009a6a 100644
--- a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/exception/Spring6ExceptionHandlerInstrumentationWithGlobalAdviceTest.java
+++ b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/exception/Spring6ExceptionHandlerInstrumentationWithGlobalAdviceTest.java
@@ -18,7 +18,7 @@
*/
package co.elastic.apm.agent.springwebmvc.exception;
-import co.elastic.apm.agent.springwebmvc.Java17OnlyTest;
+import co.elastic.apm.agent.testutils.Java17OnlyTest;
public class Spring6ExceptionHandlerInstrumentationWithGlobalAdviceTest extends Java17OnlyTest {
diff --git a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/exception/Spring6ExceptionHandlerInstrumentationWithResponseStatusExceptionTest.java b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/exception/Spring6ExceptionHandlerInstrumentationWithResponseStatusExceptionTest.java
index 27318db4ec..0d80948661 100644
--- a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/exception/Spring6ExceptionHandlerInstrumentationWithResponseStatusExceptionTest.java
+++ b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/exception/Spring6ExceptionHandlerInstrumentationWithResponseStatusExceptionTest.java
@@ -18,7 +18,7 @@
*/
package co.elastic.apm.agent.springwebmvc.exception;
-import co.elastic.apm.agent.springwebmvc.Java17OnlyTest;
+import co.elastic.apm.agent.testutils.Java17OnlyTest;
public class Spring6ExceptionHandlerInstrumentationWithResponseStatusExceptionTest extends Java17OnlyTest {
diff --git a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/template/Spring6FreeMarkerViewTest.java b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/template/Spring6FreeMarkerViewTest.java
index 37ba6d8ae9..a2abab803e 100644
--- a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/template/Spring6FreeMarkerViewTest.java
+++ b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/template/Spring6FreeMarkerViewTest.java
@@ -18,7 +18,7 @@
*/
package co.elastic.apm.agent.springwebmvc.template;
-import co.elastic.apm.agent.springwebmvc.Java17OnlyTest;
+import co.elastic.apm.agent.testutils.Java17OnlyTest;
public class Spring6FreeMarkerViewTest extends Java17OnlyTest {
public Spring6FreeMarkerViewTest() {
diff --git a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/template/Spring6GroovyTemplateTest.java b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/template/Spring6GroovyTemplateTest.java
index 9bdb50850b..168a69210e 100644
--- a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/template/Spring6GroovyTemplateTest.java
+++ b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/template/Spring6GroovyTemplateTest.java
@@ -18,7 +18,7 @@
*/
package co.elastic.apm.agent.springwebmvc.template;
-import co.elastic.apm.agent.springwebmvc.Java17OnlyTest;
+import co.elastic.apm.agent.testutils.Java17OnlyTest;
public class Spring6GroovyTemplateTest extends Java17OnlyTest {
diff --git a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/template/Spring6Jackson2JsonViewTest.java b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/template/Spring6Jackson2JsonViewTest.java
index 1dd1b71ee6..93c17d29d6 100644
--- a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/template/Spring6Jackson2JsonViewTest.java
+++ b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/template/Spring6Jackson2JsonViewTest.java
@@ -18,7 +18,7 @@
*/
package co.elastic.apm.agent.springwebmvc.template;
-import co.elastic.apm.agent.springwebmvc.Java17OnlyTest;
+import co.elastic.apm.agent.testutils.Java17OnlyTest;
public class Spring6Jackson2JsonViewTest extends Java17OnlyTest {
diff --git a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/template/Spring6JspViewTest.java b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/template/Spring6JspViewTest.java
index 45464208e1..ff0eaff4dd 100644
--- a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/template/Spring6JspViewTest.java
+++ b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/template/Spring6JspViewTest.java
@@ -18,7 +18,7 @@
*/
package co.elastic.apm.agent.springwebmvc.template;
-import co.elastic.apm.agent.springwebmvc.Java17OnlyTest;
+import co.elastic.apm.agent.testutils.Java17OnlyTest;
public class Spring6JspViewTest extends Java17OnlyTest {
diff --git a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/template/Spring6ThymeleafTest.java b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/template/Spring6ThymeleafTest.java
index 3e5d520816..9d4ee15482 100644
--- a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/template/Spring6ThymeleafTest.java
+++ b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/src/test/java/co/elastic/apm/agent/springwebmvc/template/Spring6ThymeleafTest.java
@@ -19,7 +19,7 @@
package co.elastic.apm.agent.springwebmvc.template;
-import co.elastic.apm.agent.springwebmvc.Java17OnlyTest;
+import co.elastic.apm.agent.testutils.Java17OnlyTest;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.test.context.ContextConfiguration;