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
This commit is contained in:
Sébastien Deleuze 2023-05-04 15:33:21 +02:00
parent f469eff97b
commit 9fec516560
1 changed files with 2 additions and 1 deletions

View File

@ -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();
}
}