File tree Expand file tree Collapse file tree 3 files changed +24
-0
lines changed
main/java/io/sentry/spring
test/kotlin/io/sentry/spring Expand file tree Collapse file tree 3 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 1212* Enhancement: Polish Performance API (#1165 )
1313* Enhancement: Set "debug" through external properties (#1186 )
1414* Enhancement: Simplify Spring integration (#1188 )
15+ * Enhancement: Auto register custom ITransportFactory in Spring integration (#1194 )
1516* Enhancement: Improve Kotlin property access in Performance API (#1193 )
1617
1718# 4.0.0-alpha.3
Original file line number Diff line number Diff line change 11package io .sentry .spring ;
22
33import com .jakewharton .nopen .annotation .Open ;
4+ import io .sentry .ITransportFactory ;
45import io .sentry .Sentry ;
56import io .sentry .SentryOptions ;
67import io .sentry .SentryOptions .TracesSamplerCallback ;
@@ -33,6 +34,9 @@ public Object postProcessAfterInitialization(
3334 applicationContext
3435 .getBeanProvider (TracesSamplerCallback .class )
3536 .ifAvailable (options ::setTracesSampler );
37+ applicationContext
38+ .getBeanProvider (ITransportFactory .class )
39+ .ifAvailable (options ::setTransportFactory );
3640 }
3741 Sentry .init (options );
3842 }
Original file line number Diff line number Diff line change 11package io.sentry.spring
22
3+ import com.nhaarman.mockitokotlin2.mock
34import io.sentry.IHub
5+ import io.sentry.ITransportFactory
46import io.sentry.SentryOptions
57import kotlin.test.Test
68import org.assertj.core.api.Assertions.assertThat
@@ -92,6 +94,16 @@ class EnableSentryTest {
9294 }
9395 }
9496
97+ @Test
98+ fun `configures custom TransportFactory` () {
99+ ApplicationContextRunner ().withConfiguration(UserConfigurations .of(AppConfigWithCustomTransportFactory ::class .java))
100+ .run {
101+ val options = it.getBean(SentryOptions ::class .java)
102+ val transportFactory = it.getBean(ITransportFactory ::class .java)
103+ assertThat(options.transportFactory).isEqualTo(transportFactory)
104+ }
105+ }
106+
95107 @EnableSentry(dsn = " http://key@localhost/proj" )
96108 class AppConfig
97109
@@ -114,4 +126,11 @@ class EnableSentryTest {
114126 }
115127 }
116128 }
129+
130+ @EnableSentry(dsn = " http://key@localhost/proj" )
131+ class AppConfigWithCustomTransportFactory {
132+
133+ @Bean
134+ fun tracesSampler () = mock<ITransportFactory >()
135+ }
117136}
You can’t perform that action at this time.
0 commit comments