Skip to content

Commit 9fec516

Browse files
committed
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
1 parent f469eff commit 9fec516

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

spring-context/src/main/java/org/springframework/context/support/DefaultLifecycleProcessor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
import org.springframework.context.LifecycleProcessor;
4444
import org.springframework.context.Phased;
4545
import org.springframework.context.SmartLifecycle;
46+
import org.springframework.core.NativeDetector;
4647
import org.springframework.lang.Nullable;
4748
import org.springframework.util.Assert;
4849
import org.springframework.util.ClassUtils;
@@ -79,7 +80,7 @@ public class DefaultLifecycleProcessor implements LifecycleProcessor, BeanFactor
7980

8081

8182
public DefaultLifecycleProcessor() {
82-
if (ClassUtils.isPresent("org.crac.Core", getClass().getClassLoader())) {
83+
if (!NativeDetector.inNativeImage() && ClassUtils.isPresent("org.crac.Core", getClass().getClassLoader())) {
8384
this.cracResource = new CracDelegate().registerResource();
8485
}
8586
}

0 commit comments

Comments
 (0)