Skip to content

Commit d26ed75

Browse files
committed
Enable ThreadLocalAccessor for Spring Boot 3 WebFlux by default
1 parent 94a1eb0 commit d26ed75

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentryWebfluxAutoConfiguration.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,7 @@ public SentryLegacyFilterConfigurationCondition() {
9191

9292
@ConditionalOnProperty(
9393
name = "sentry.reactive.thread-local-accessor-enabled",
94-
havingValue = "false",
95-
matchIfMissing = true)
94+
havingValue = "false")
9695
@SuppressWarnings("UnusedNestedClass")
9796
private static class SentryDisableThreadLocalAccessorCondition {}
9897

@@ -109,7 +108,8 @@ public SentryThreadLocalAccessorCondition() {
109108

110109
@ConditionalOnProperty(
111110
name = "sentry.reactive.thread-local-accessor-enabled",
112-
havingValue = "true")
111+
havingValue = "true",
112+
matchIfMissing = true)
113113
@SuppressWarnings("UnusedNestedClass")
114114
private static class SentryEnableThreadLocalAccessorCondition {}
115115

sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryWebfluxAutoConfigurationTest.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ class SentryWebfluxAutoConfigurationTest {
2121
fun `configures sentryWebFilter`() {
2222
contextRunner.withPropertyValues("sentry.dsn=http://key@localhost/proj")
2323
.run {
24-
assertThat(it).hasSingleBean(SentryWebFilter::class.java)
25-
assertThat(it).doesNotHaveBean(SentryWebFilterWithThreadLocalAccessor::class.java)
24+
assertThat(it).hasSingleBean(SentryWebFilterWithThreadLocalAccessor::class.java)
25+
assertThat(it).doesNotHaveBean(SentryWebFilter::class.java)
2626
}
2727
}
2828

@@ -63,6 +63,7 @@ class SentryWebfluxAutoConfigurationTest {
6363
)
6464
.run {
6565
assertThat(it).hasSingleBean(SentryWebFilterWithThreadLocalAccessor::class.java)
66+
assertThat(it).doesNotHaveBean(SentryWebFilter::class.java)
6667
}
6768
}
6869

@@ -75,6 +76,7 @@ class SentryWebfluxAutoConfigurationTest {
7576
)
7677
.run {
7778
assertThat(it).doesNotHaveBean(SentryWebFilterWithThreadLocalAccessor::class.java)
79+
assertThat(it).hasSingleBean(SentryWebFilter::class.java)
7880
}
7981
}
8082

0 commit comments

Comments
 (0)