From 9fec516560741a01c9049b5526113f2a94c72387 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deleuze?= Date: Thu, 4 May 2023 15:33:21 +0200 Subject: [PATCH] Skip CRaC support with native images Skip CRaC support with native images to avoid compiling related infrastructure to the native image and to fix tests via gh-30422. See gh-30242 --- .../context/support/DefaultLifecycleProcessor.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-context/src/main/java/org/springframework/context/support/DefaultLifecycleProcessor.java b/spring-context/src/main/java/org/springframework/context/support/DefaultLifecycleProcessor.java index beb9579519..78a13f8a8f 100644 --- a/spring-context/src/main/java/org/springframework/context/support/DefaultLifecycleProcessor.java +++ b/spring-context/src/main/java/org/springframework/context/support/DefaultLifecycleProcessor.java @@ -43,6 +43,7 @@ import org.springframework.context.Lifecycle; import org.springframework.context.LifecycleProcessor; import org.springframework.context.Phased; import org.springframework.context.SmartLifecycle; +import org.springframework.core.NativeDetector; import org.springframework.lang.Nullable; import org.springframework.util.Assert; import org.springframework.util.ClassUtils; @@ -79,7 +80,7 @@ public class DefaultLifecycleProcessor implements LifecycleProcessor, BeanFactor public DefaultLifecycleProcessor() { - if (ClassUtils.isPresent("org.crac.Core", getClass().getClassLoader())) { + if (!NativeDetector.inNativeImage() && ClassUtils.isPresent("org.crac.Core", getClass().getClassLoader())) { this.cracResource = new CracDelegate().registerResource(); } }