Fix check for using CoordinatedRestoreAtCheckpointStartup

Closes gh-38186
This commit is contained in:
Andy Wilkinson 2023-11-03 09:57:12 +00:00
parent 4d0b50e967
commit 9eda564d06
1 changed files with 4 additions and 2 deletions

View File

@ -1684,8 +1684,10 @@ public class SpringApplication {
}
static Startup create() {
return (!ClassUtils.isPresent("jdk.crac.management.CRaCMXBean", Startup.class.getClassLoader()))
? new StandardStartup() : new CoordinatedRestoreAtCheckpointStartup();
ClassLoader classLoader = Startup.class.getClassLoader();
return (ClassUtils.isPresent("jdk.crac.management.CRaCMXBean", classLoader)
&& ClassUtils.isPresent("org.crac.management.CRaCMXBean", classLoader))
? new CoordinatedRestoreAtCheckpointStartup() : new StandardStartup();
}
}