diff --git a/CHANGELOG.md b/CHANGELOG.md index a72d912270..3843aefc1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ - Send `http.request.method` in span data ([#2896](https://github.com/getsentry/sentry-java/pull/2896)) - Add `enablePrettySerializationOutput` option for opting out of pretty print ([#2871](https://github.com/getsentry/sentry-java/pull/2871)) +### Fixes + +- Add `sentry.enable-aot-compatibility` property to SpringBoot Jakarta `SentryAutoConfiguration` to enable building for GraalVM ([#2915](https://github.com/getsentry/sentry-java/pull/2915)) + ## 6.28.0 ### Features diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/resources/application.properties b/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/resources/application.properties index 8151eacc6c..75f030786c 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/resources/application.properties +++ b/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/resources/application.properties @@ -13,6 +13,11 @@ sentry.enable-tracing=true sentry.debug=true in-app-includes="io.sentry.samples" +# Uncomment and set to true to enable aot compatibility +# This is disables all AOP related features (i.e. @SentryTransaction, @SentrySpan) +# to successfully compile to GraalVM +# sentry.enable-aot-compatibility=false + # Database configuration spring.datasource.url=jdbc:p6spy:hsqldb:mem:testdb spring.datasource.driver-class-name=com.p6spy.engine.spy.P6SpyDriver diff --git a/sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentryAutoConfiguration.java b/sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentryAutoConfiguration.java index 3ca17f75b4..d3b071c1e8 100644 --- a/sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentryAutoConfiguration.java +++ b/sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentryAutoConfiguration.java @@ -273,6 +273,10 @@ public FilterRegistrationBean sentryTracingFilter( } @Configuration(proxyBeanMethods = false) + @ConditionalOnProperty( + value = "sentry.enable-aot-compatibility", + havingValue = "false", + matchIfMissing = true) @Conditional(SentryTracingCondition.class) @ConditionalOnClass(ProceedingJoinPoint.class) @Import(SentryAdviceConfiguration.class) diff --git a/sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentryProperties.java b/sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentryProperties.java index 6b263a3303..56535b5b18 100644 --- a/sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentryProperties.java +++ b/sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentryProperties.java @@ -33,6 +33,8 @@ public class SentryProperties extends SentryOptions { /** Reactive framework (e.g. WebFlux) integration properties */ private @NotNull Reactive reactive = new Reactive(); + private boolean enableAotCompatibility = false; + public boolean isUseGitCommitIdAsRelease() { return useGitCommitIdAsRelease; } @@ -85,6 +87,14 @@ public void setReactive(@NotNull Reactive reactive) { this.reactive = reactive; } + public boolean isEnableAotCompatibility() { + return enableAotCompatibility; + } + + public void setEnableAotCompatibility(boolean enableAotCompatibility) { + this.enableAotCompatibility = enableAotCompatibility; + } + @Open public static class Logging { /** Enable/Disable logging auto-configuration. */