From 8751834aa12e4a6f802bb1a0f27f24f51609a98f Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Tue, 10 Nov 2026 09:15:15 +0100 Subject: [PATCH 1/5] build(deps): Bump Spring Boot to 4.2.0-RC2 Align OpenTelemetry with the version managed by Spring Boot 4.2. Keep RestTemplate support compiling despite upstream removal warnings and update tests for OpenTelemetry's no-processor optimization. Co-Authored-By: Claude --- gradle/libs.versions.toml | 10 +++--- .../src/test/kotlin/SentrySamplerTest.kt | 32 ++++++++++++------- .../test/kotlin/OtelSentryPropagatorTest.kt | 12 +++++-- .../src/test/kotlin/OtlpEndToEndTest.kt | 10 +++++- .../spring/boot4/SentryAutoConfiguration.java | 1 + .../SentrySpanRestTemplateCustomizer.java | 1 + 6 files changed, 46 insertions(+), 20 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e8175ecec06..30f6f6f0471 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -29,10 +29,10 @@ nopen = "1.0.1" # see https://developer.android.com/jetpack/androidx/releases/compose-kotlin okhttp = "5.5.1" openfeature = "1.18.2" -otel = "1.63.0" -otelAlpha = "1.63.0-alpha" -otelInstrumentation = "2.29.0" -otelInstrumentationAlpha = "2.29.0-alpha" +otel = "1.67.0" +otelAlpha = "1.67.0-alpha" +otelInstrumentation = "2.33.1" +otelInstrumentationAlpha = "2.33.1-alpha" # check https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/dependencyManagement/build.gradle.kts#L49 for release version above to find a compatible version otelSemanticConventions = "1.42.0" otelSemanticConventionsAlpha = "1.42.0-alpha" @@ -48,7 +48,7 @@ slf4j = "1.7.30" spotless = "8.8.0" springboot2 = "2.7.18" springboot3 = "3.5.0" -springboot4 = "4.1.0" +springboot4 = "4.2.0-RC2" springKafka2 = "2.8.11" springKafka3 = "3.3.5" sqldelight = "2.3.2" diff --git a/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/SentrySamplerTest.kt b/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/SentrySamplerTest.kt index 8a8ec0c8e0d..242b1cb35a6 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/SentrySamplerTest.kt +++ b/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/SentrySamplerTest.kt @@ -9,6 +9,8 @@ import io.opentelemetry.api.trace.TraceFlags import io.opentelemetry.api.trace.TraceState import io.opentelemetry.context.Context import io.opentelemetry.sdk.trace.SdkTracerProvider +import io.opentelemetry.sdk.trace.export.SimpleSpanProcessor +import io.opentelemetry.sdk.trace.export.SpanExporter import io.opentelemetry.sdk.trace.samplers.Sampler import io.opentelemetry.sdk.trace.samplers.SamplingDecision import io.sentry.DataCategory @@ -138,18 +140,24 @@ class SentrySamplerTest { verify(onDiscard).execute(DiscardReason.CALLBACK_ERROR, DataCategory.Span, 1) verifyNoMoreInteractions(onDiscard) val recordingSampler = mock(defaultAnswer = delegatesTo(sampler)) - SdkTracerProvider.builder().setSampler(recordingSampler).build().use { provider -> - val openTelemetry = - mock().also { - whenever(it.tracerProvider).thenReturn(provider) - } - OtelSpanFactory(openTelemetry).createTransaction(context, scopes, TransactionOptions(), null) - val attributes = argumentCaptor() - verify(recordingSampler).shouldSample(any(), any(), any(), any(), attributes.capture(), any()) - val restored = OtelSamplingUtil.extractSamplingDecision(attributes.firstValue)!! - assertThat(restored.sampled).isFalse() - assertThat(restored.profileSampled).isFalse() - } + SdkTracerProvider.builder() + .setSampler(recordingSampler) + .addSpanProcessor(SimpleSpanProcessor.create(SpanExporter.composite())) + .build() + .use { provider -> + val openTelemetry = + mock().also { + whenever(it.tracerProvider).thenReturn(provider) + } + OtelSpanFactory(openTelemetry) + .createTransaction(context, scopes, TransactionOptions(), null) + val attributes = argumentCaptor() + verify(recordingSampler) + .shouldSample(any(), any(), any(), any(), attributes.capture(), any()) + val restored = OtelSamplingUtil.extractSamplingDecision(attributes.firstValue)!! + assertThat(restored.sampled).isFalse() + assertThat(restored.profileSampled).isFalse() + } verifyNoMoreInteractions(onDiscard) } diff --git a/sentry-opentelemetry/sentry-opentelemetry-otlp/src/test/kotlin/OtelSentryPropagatorTest.kt b/sentry-opentelemetry/sentry-opentelemetry-otlp/src/test/kotlin/OtelSentryPropagatorTest.kt index afa728c7ff0..d0220daf952 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-otlp/src/test/kotlin/OtelSentryPropagatorTest.kt +++ b/sentry-opentelemetry/sentry-opentelemetry-otlp/src/test/kotlin/OtelSentryPropagatorTest.kt @@ -8,6 +8,8 @@ import io.opentelemetry.context.Context import io.opentelemetry.context.propagation.TextMapGetter import io.opentelemetry.context.propagation.TextMapSetter import io.opentelemetry.sdk.trace.SdkTracerProvider +import io.opentelemetry.sdk.trace.export.SimpleSpanProcessor +import io.opentelemetry.sdk.trace.export.SpanExporter import io.sentry.Baggage import io.sentry.Sentry import kotlin.test.AfterTest @@ -180,7 +182,10 @@ class OpenTelemetryOtlpPropagatorTest { } val propagator = OpenTelemetryOtlpPropagator() val carrier = mutableMapOf() - val tracerProvider = SdkTracerProvider.builder().build() + val tracerProvider = + SdkTracerProvider.builder() + .addSpanProcessor(SimpleSpanProcessor.create(SpanExporter.composite())) + .build() val otelSpan = tracerProvider .get("test") @@ -220,7 +225,10 @@ class OpenTelemetryOtlpPropagatorTest { } val propagator = OpenTelemetryOtlpPropagator() val carrier = mutableMapOf() - val tracerProvider = SdkTracerProvider.builder().build() + val tracerProvider = + SdkTracerProvider.builder() + .addSpanProcessor(SimpleSpanProcessor.create(SpanExporter.composite())) + .build() val otelSpan = tracerProvider .get("test") diff --git a/sentry-opentelemetry/sentry-opentelemetry-otlp/src/test/kotlin/OtlpEndToEndTest.kt b/sentry-opentelemetry/sentry-opentelemetry-otlp/src/test/kotlin/OtlpEndToEndTest.kt index fb3db9731e8..ca94bc1fad3 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-otlp/src/test/kotlin/OtlpEndToEndTest.kt +++ b/sentry-opentelemetry/sentry-opentelemetry-otlp/src/test/kotlin/OtlpEndToEndTest.kt @@ -3,6 +3,8 @@ package io.sentry.opentelemetry.otlp import com.google.common.truth.Truth.assertThat import io.opentelemetry.sdk.OpenTelemetrySdk import io.opentelemetry.sdk.trace.SdkTracerProvider +import io.opentelemetry.sdk.trace.export.SimpleSpanProcessor +import io.opentelemetry.sdk.trace.export.SpanExporter import io.sentry.Sentry import io.sentry.test.MockSentryServer import io.sentry.test.event @@ -20,7 +22,13 @@ import kotlin.test.Test class OtlpEndToEndTest { private val server = MockSentryServer() private val openTelemetry = - OpenTelemetrySdk.builder().setTracerProvider(SdkTracerProvider.builder().build()).build() + OpenTelemetrySdk.builder() + .setTracerProvider( + SdkTracerProvider.builder() + .addSpanProcessor(SimpleSpanProcessor.create(SpanExporter.composite())) + .build() + ) + .build() @AfterTest fun teardown() { diff --git a/sentry-spring-boot-4/src/main/java/io/sentry/spring/boot4/SentryAutoConfiguration.java b/sentry-spring-boot-4/src/main/java/io/sentry/spring/boot4/SentryAutoConfiguration.java index 8562d14f160..734bd5d8a5c 100644 --- a/sentry-spring-boot-4/src/main/java/io/sentry/spring/boot4/SentryAutoConfiguration.java +++ b/sentry-spring-boot-4/src/main/java/io/sentry/spring/boot4/SentryAutoConfiguration.java @@ -512,6 +512,7 @@ static class SentrySpanPointcutAutoConfiguration {} @Configuration(proxyBeanMethods = false) @ConditionalOnClass({RestTemplate.class, RestTemplateAutoConfiguration.class}) @Open + @SuppressWarnings("removal") static class SentryPerformanceRestTemplateConfigurationWrapper { @Configuration(proxyBeanMethods = false) @AutoConfigureBefore(RestTemplateAutoConfiguration.class) diff --git a/sentry-spring-boot-4/src/main/java/io/sentry/spring/boot4/SentrySpanRestTemplateCustomizer.java b/sentry-spring-boot-4/src/main/java/io/sentry/spring/boot4/SentrySpanRestTemplateCustomizer.java index 11a0b5e095a..7e2a56ba521 100644 --- a/sentry-spring-boot-4/src/main/java/io/sentry/spring/boot4/SentrySpanRestTemplateCustomizer.java +++ b/sentry-spring-boot-4/src/main/java/io/sentry/spring/boot4/SentrySpanRestTemplateCustomizer.java @@ -11,6 +11,7 @@ import org.springframework.web.client.RestTemplate; @Open +@SuppressWarnings("removal") class SentrySpanRestTemplateCustomizer implements RestTemplateCustomizer { private final @NotNull SentrySpanClientHttpRequestInterceptor interceptor; From 8fde3be35039ebe78aa43f4f533fac775b18c1ae Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Tue, 10 Nov 2026 10:14:37 +0100 Subject: [PATCH 2/5] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e1e21e6d22..343aa28a522 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ ### Dependencies +- Bump Spring Boot 4 from 4.1.0 to 4.2.0-RC2 and OpenTelemetry from 1.63.0 / 2.29.0 to 1.67.0 / 2.33.1 ([#6532](https://github.com/getsentry/sentry-java/pull/6532)) - Bump OkHttp from 4.9.2 to 5.5.1 ([#6472](https://github.com/getsentry/sentry-java/pull/6472)) - `sentry-okhttp` and the Spring Boot integrations keep OkHttp as a `compileOnly` dependency, so your app keeps the OkHttp version it declares. OkHttp 4 is still supported. - [changelog](https://github.com/square/okhttp/blob/master/CHANGELOG.md) From b458c42cbfa2850459cfc571bd3e20e15357d453 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Tue, 10 Nov 2026 10:28:06 +0100 Subject: [PATCH 3/5] fix(spring): Suppress RestTemplate removal warnings Keep the Spring 7 sample compiling with warnings treated as errors after the Spring Boot 4.2 dependency bump. Co-Authored-By: Claude --- .../src/main/java/io/sentry/samples/spring7/WebConfig.java | 1 + .../main/java/io/sentry/samples/spring7/web/PersonService.java | 2 ++ .../io/sentry/samples/spring/boot4/SentryDemoApplication.java | 1 + .../java/io/sentry/samples/spring/boot4/TodoController.java | 1 + .../io/sentry/samples/spring/boot4/SentryDemoApplication.java | 1 + .../java/io/sentry/samples/spring/boot4/TodoController.java | 1 + .../io/sentry/samples/spring/boot4/SentryDemoApplication.java | 1 + .../java/io/sentry/samples/spring/boot4/TodoController.java | 1 + .../sentry/samples/spring/boot4/otlp/SentryDemoApplication.java | 1 + .../io/sentry/samples/spring/boot4/otlp/TodoController.java | 1 + .../io/sentry/samples/spring/boot4/SentryDemoApplication.java | 1 + .../java/io/sentry/samples/spring/boot4/TodoController.java | 1 + 12 files changed, 13 insertions(+) diff --git a/sentry-samples/sentry-samples-spring-7/src/main/java/io/sentry/samples/spring7/WebConfig.java b/sentry-samples/sentry-samples-spring-7/src/main/java/io/sentry/samples/spring7/WebConfig.java index e8dce9b35c4..8da3f75822d 100644 --- a/sentry-samples/sentry-samples-spring-7/src/main/java/io/sentry/samples/spring7/WebConfig.java +++ b/sentry-samples/sentry-samples-spring-7/src/main/java/io/sentry/samples/spring7/WebConfig.java @@ -24,6 +24,7 @@ public class WebConfig { * @return RestTemplate */ @Bean + @SuppressWarnings("removal") RestTemplate restTemplate(IScopes scopes) { RestTemplate restTemplate = new RestTemplate(); SentrySpanClientHttpRequestInterceptor sentryRestTemplateInterceptor = diff --git a/sentry-samples/sentry-samples-spring-7/src/main/java/io/sentry/samples/spring7/web/PersonService.java b/sentry-samples/sentry-samples-spring-7/src/main/java/io/sentry/samples/spring7/web/PersonService.java index fbe5b67ba4c..753d6eab482 100644 --- a/sentry-samples/sentry-samples-spring-7/src/main/java/io/sentry/samples/spring7/web/PersonService.java +++ b/sentry-samples/sentry-samples-spring-7/src/main/java/io/sentry/samples/spring7/web/PersonService.java @@ -7,8 +7,10 @@ @Service public class PersonService { + @SuppressWarnings("removal") private final RestTemplate restTemplate; + @SuppressWarnings("removal") public PersonService(RestTemplate restTemplate) { this.restTemplate = restTemplate; } diff --git a/sentry-samples/sentry-samples-spring-boot-4-log4j2/src/main/java/io/sentry/samples/spring/boot4/SentryDemoApplication.java b/sentry-samples/sentry-samples-spring-boot-4-log4j2/src/main/java/io/sentry/samples/spring/boot4/SentryDemoApplication.java index 13d97fa8442..904c60b0eb4 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-log4j2/src/main/java/io/sentry/samples/spring/boot4/SentryDemoApplication.java +++ b/sentry-samples/sentry-samples-spring-boot-4-log4j2/src/main/java/io/sentry/samples/spring/boot4/SentryDemoApplication.java @@ -22,6 +22,7 @@ @SpringBootApplication @EnableCaching @EnableScheduling +@SuppressWarnings("removal") public class SentryDemoApplication { public static void main(String[] args) { SpringApplication.run(SentryDemoApplication.class, args); diff --git a/sentry-samples/sentry-samples-spring-boot-4-log4j2/src/main/java/io/sentry/samples/spring/boot4/TodoController.java b/sentry-samples/sentry-samples-spring-boot-4-log4j2/src/main/java/io/sentry/samples/spring/boot4/TodoController.java index 0f71cca0419..e5f395ec2b5 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-log4j2/src/main/java/io/sentry/samples/spring/boot4/TodoController.java +++ b/sentry-samples/sentry-samples-spring-boot-4-log4j2/src/main/java/io/sentry/samples/spring/boot4/TodoController.java @@ -12,6 +12,7 @@ import reactor.core.scheduler.Schedulers; @RestController +@SuppressWarnings("removal") public class TodoController { private final RestTemplate restTemplate; private final WebClient webClient; diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/SentryDemoApplication.java b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/SentryDemoApplication.java index 61e726defcb..80a550e7ef7 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/SentryDemoApplication.java +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/SentryDemoApplication.java @@ -22,6 +22,7 @@ @SpringBootApplication @EnableScheduling +@SuppressWarnings("removal") public class SentryDemoApplication { public static void main(String[] args) { SpringApplication.run(SentryDemoApplication.class, args); diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/TodoController.java b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/TodoController.java index d4fda10d0bd..c5093bc9cf5 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/TodoController.java +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/TodoController.java @@ -18,6 +18,7 @@ import reactor.core.scheduler.Schedulers; @RestController +@SuppressWarnings("removal") public class TodoController { private final RestTemplate restTemplate; private final WebClient webClient; diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/SentryDemoApplication.java b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/SentryDemoApplication.java index b00609ad9ac..77049f70a56 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/SentryDemoApplication.java +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/SentryDemoApplication.java @@ -24,6 +24,7 @@ @SpringBootApplication @EnableCaching @EnableScheduling +@SuppressWarnings("removal") public class SentryDemoApplication { public static void main(String[] args) { SpringApplication.run(SentryDemoApplication.class, args); diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/TodoController.java b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/TodoController.java index d4fda10d0bd..c5093bc9cf5 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/TodoController.java +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/TodoController.java @@ -18,6 +18,7 @@ import reactor.core.scheduler.Schedulers; @RestController +@SuppressWarnings("removal") public class TodoController { private final RestTemplate restTemplate; private final WebClient webClient; diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/SentryDemoApplication.java b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/SentryDemoApplication.java index 1bf622154d0..d0a958c536e 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/SentryDemoApplication.java +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/SentryDemoApplication.java @@ -25,6 +25,7 @@ @SpringBootApplication @EnableCaching @EnableScheduling +@SuppressWarnings("removal") public class SentryDemoApplication { public static void main(String[] args) { SpringApplication.run(SentryDemoApplication.class, args); diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/TodoController.java b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/TodoController.java index b083e6c1f88..9a4dd98c90b 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/TodoController.java +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/TodoController.java @@ -12,6 +12,7 @@ import reactor.core.scheduler.Schedulers; @RestController +@SuppressWarnings("removal") public class TodoController { private final RestTemplate restTemplate; private final WebClient webClient; diff --git a/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/SentryDemoApplication.java b/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/SentryDemoApplication.java index 03688f1a84c..a8437db87c3 100644 --- a/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/SentryDemoApplication.java +++ b/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/SentryDemoApplication.java @@ -23,6 +23,7 @@ @SpringBootApplication @EnableCaching @EnableScheduling +@SuppressWarnings("removal") public class SentryDemoApplication { public static void main(String[] args) { SpringApplication.run(SentryDemoApplication.class, args); diff --git a/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/TodoController.java b/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/TodoController.java index a24cf2bb3cc..0bbe0643495 100644 --- a/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/TodoController.java +++ b/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/TodoController.java @@ -19,6 +19,7 @@ import tools.jackson.databind.ObjectMapper; @RestController +@SuppressWarnings("removal") public class TodoController { private final RestTemplate restTemplate; private final WebClient webClient; From e648c66d419bc3ac38ac1cde06a884d336552cdd Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Tue, 10 Nov 2026 11:18:16 +0100 Subject: [PATCH 4/5] build(deps): Add Spring milestone repository Resolve Spring Boot 4.2 release candidate plugin and framework artifacts in clean CI environments. Co-Authored-By: Claude --- sentry-samples/settings.gradle.kts | 6 ++++++ settings.gradle.kts | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/sentry-samples/settings.gradle.kts b/sentry-samples/settings.gradle.kts index ad2fe3e3db6..9b3557f99fb 100644 --- a/sentry-samples/settings.gradle.kts +++ b/sentry-samples/settings.gradle.kts @@ -1,6 +1,9 @@ pluginManagement { repositories { mavenCentral() + maven("https://repo.spring.io/milestone") { + content { includeGroupByRegex("org\\.springframework.*") } + } gradlePluginPortal() } } @@ -20,6 +23,9 @@ develocity { dependencyResolutionManagement { repositories { mavenCentral() + maven("https://repo.spring.io/milestone") { + content { includeGroupByRegex("org\\.springframework.*") } + } mavenLocal() } versionCatalogs { diff --git a/settings.gradle.kts b/settings.gradle.kts index 852765c03d8..9f61bddf4f7 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -3,6 +3,9 @@ enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") pluginManagement { repositories { mavenCentral() + maven("https://repo.spring.io/milestone") { + content { includeGroupByRegex("org\\.springframework.*") } + } gradlePluginPortal() google() } @@ -36,6 +39,9 @@ dependencyResolutionManagement { repositories { google() mavenCentral() + maven("https://repo.spring.io/milestone") { + content { includeGroupByRegex("org\\.springframework.*") } + } mavenLocal() } } From a59d44f7111fb23504bd3ccd0eea9618296e2175 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Tue, 10 Nov 2026 11:31:25 +0100 Subject: [PATCH 5/5] test(spring): Build valid GraphQL operation documents Include a selection set so GraphQL Java 25 can print the test operations used by Spring subscription error reporting tests. Co-Authored-By: Claude --- .../SentrySpringSubscriptionHandlerTest.kt | 37 +++++++++---------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/graphql/SentrySpringSubscriptionHandlerTest.kt b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/graphql/SentrySpringSubscriptionHandlerTest.kt index 1ed217037a2..24f32e77f88 100644 --- a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/graphql/SentrySpringSubscriptionHandlerTest.kt +++ b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/graphql/SentrySpringSubscriptionHandlerTest.kt @@ -2,7 +2,9 @@ package io.sentry.spring7.graphql import graphql.execution.instrumentation.parameters.InstrumentationFieldFetchParameters import graphql.language.Document +import graphql.language.Field import graphql.language.OperationDefinition +import graphql.language.SelectionSet import graphql.schema.DataFetchingEnvironment import io.sentry.IScopes import io.sentry.graphql.ExceptionReporter @@ -20,6 +22,19 @@ import org.springframework.graphql.execution.SubscriptionPublisherException import reactor.core.publisher.Flux class SentrySpringSubscriptionHandlerTest { + private val document = + Document.newDocument() + .definition( + OperationDefinition.newOperationDefinition() + .operation(OperationDefinition.Operation.QUERY) + .name("testQuery") + .selectionSet( + SelectionSet.newSelectionSet().selection(Field.newField("test").build()).build() + ) + .build() + ) + .build() + @Test fun `reports exception`() { val exception = IllegalStateException("some exception") @@ -27,15 +42,6 @@ class SentrySpringSubscriptionHandlerTest { val exceptionReporter = mock() val parameters = mock() val dataFetchingEnvironment = mock() - val document = - Document.newDocument() - .definition( - OperationDefinition.newOperationDefinition() - .operation(OperationDefinition.Operation.QUERY) - .name("testQuery") - .build() - ) - .build() whenever(dataFetchingEnvironment.document).thenReturn(document) whenever(parameters.environment).thenReturn(dataFetchingEnvironment) val resultObject = @@ -49,7 +55,7 @@ class SentrySpringSubscriptionHandlerTest { check { assertEquals(true, it.isSubscription) assertSame(scopes, it.scopes) - assertEquals("query testQuery \n", it.query) + assertEquals("query testQuery {\n test\n}\n", it.query) }, anyOrNull(), ) @@ -63,15 +69,6 @@ class SentrySpringSubscriptionHandlerTest { val exceptionReporter = mock() val parameters = mock() val dataFetchingEnvironment = mock() - val document = - Document.newDocument() - .definition( - OperationDefinition.newOperationDefinition() - .operation(OperationDefinition.Operation.QUERY) - .name("testQuery") - .build() - ) - .build() whenever(dataFetchingEnvironment.document).thenReturn(document) whenever(parameters.environment).thenReturn(dataFetchingEnvironment) val resultObject = @@ -90,7 +87,7 @@ class SentrySpringSubscriptionHandlerTest { check { assertEquals(true, it.isSubscription) assertSame(scopes, it.scopes) - assertEquals("query testQuery \n", it.query) + assertEquals("query testQuery {\n test\n}\n", it.query) }, anyOrNull(), )