Skip to content

Commit 6c21863

Browse files
authored
add property to disable AOP related features that break graalvm build (#2915)
1 parent 3df3cb3 commit 6c21863

File tree

5 files changed

+27
-0
lines changed

5 files changed

+27
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
- Always send memory stats for transactions ([#2936](https://github.com/getsentry/sentry-java/pull/2936))
1313
- This makes it possible to query transactions by the `device.class` tag on Sentry
14+
- Add `sentry.enable-aot-compatibility` property to SpringBoot Jakarta `SentryAutoConfiguration` to enable building for GraalVM ([#2915](https://github.com/getsentry/sentry-java/pull/2915))
1415

1516
### Dependencies
1617

sentry-samples/sentry-samples-spring-boot-jakarta/src/main/resources/application.properties

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ sentry.enable-tracing=true
1313
sentry.debug=true
1414
in-app-includes="io.sentry.samples"
1515

16+
# Uncomment and set to true to enable aot compatibility
17+
# This flag disables all AOP related features (i.e. @SentryTransaction, @SentrySpan)
18+
# to successfully compile to GraalVM
19+
# sentry.enable-aot-compatibility=false
20+
1621
# Database configuration
1722
spring.datasource.url=jdbc:p6spy:hsqldb:mem:testdb
1823
spring.datasource.driver-class-name=com.p6spy.engine.spy.P6SpyDriver

sentry-spring-boot-jakarta/api/sentry-spring-boot-jakarta.api

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ public class io/sentry/spring/boot/jakarta/SentryProperties : io/sentry/SentryOp
2424
public fun getLogging ()Lio/sentry/spring/boot/jakarta/SentryProperties$Logging;
2525
public fun getReactive ()Lio/sentry/spring/boot/jakarta/SentryProperties$Reactive;
2626
public fun getUserFilterOrder ()Ljava/lang/Integer;
27+
public fun isEnableAotCompatibility ()Z
2728
public fun isUseGitCommitIdAsRelease ()Z
29+
public fun setEnableAotCompatibility (Z)V
2830
public fun setExceptionResolverOrder (I)V
2931
public fun setLogging (Lio/sentry/spring/boot/jakarta/SentryProperties$Logging;)V
3032
public fun setReactive (Lio/sentry/spring/boot/jakarta/SentryProperties$Reactive;)V

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,10 @@ public FilterRegistrationBean<SentryTracingFilter> sentryTracingFilter(
273273
}
274274

275275
@Configuration(proxyBeanMethods = false)
276+
@ConditionalOnProperty(
277+
value = "sentry.enable-aot-compatibility",
278+
havingValue = "false",
279+
matchIfMissing = true)
276280
@Conditional(SentryTracingCondition.class)
277281
@ConditionalOnClass(ProceedingJoinPoint.class)
278282
@Import(SentryAdviceConfiguration.class)

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ public class SentryProperties extends SentryOptions {
3333
/** Reactive framework (e.g. WebFlux) integration properties */
3434
private @NotNull Reactive reactive = new Reactive();
3535

36+
/**
37+
* If set to true, this flag disables all AOP related features (e.g. {@link
38+
* io.sentry.spring.jakarta.tracing.SentryTransaction}, {@link
39+
* io.sentry.spring.jakarta.tracing.SentrySpan}) to successfully compile to GraalVM
40+
*/
41+
private boolean enableAotCompatibility = false;
42+
3643
public boolean isUseGitCommitIdAsRelease() {
3744
return useGitCommitIdAsRelease;
3845
}
@@ -85,6 +92,14 @@ public void setReactive(@NotNull Reactive reactive) {
8592
this.reactive = reactive;
8693
}
8794

95+
public boolean isEnableAotCompatibility() {
96+
return enableAotCompatibility;
97+
}
98+
99+
public void setEnableAotCompatibility(boolean enableAotCompatibility) {
100+
this.enableAotCompatibility = enableAotCompatibility;
101+
}
102+
88103
@Open
89104
public static class Logging {
90105
/** Enable/Disable logging auto-configuration. */

0 commit comments

Comments
 (0)