Avoid NoSuchMethodError by assigning ApplicationContextInitializer

See gh-32555
pull/29403/merge
Stephane Nicoll 2 years ago
parent 7a5b61fd19
commit f0e40bb00d

@ -420,7 +420,9 @@ public class SpringApplication {
initializers.stream().filter(AotApplicationContextInitializer.class::isInstance).toList()); initializers.stream().filter(AotApplicationContextInitializer.class::isInstance).toList());
if (aotInitializers.isEmpty()) { if (aotInitializers.isEmpty()) {
String initializerClassName = this.mainApplicationClass.getName() + "__ApplicationContextInitializer"; String initializerClassName = this.mainApplicationClass.getName() + "__ApplicationContextInitializer";
aotInitializers.add(AotApplicationContextInitializer.forInitializerClasses(initializerClassName)); AotApplicationContextInitializer<ConfigurableApplicationContext> initializer = AotApplicationContextInitializer
.forInitializerClasses(initializerClassName);
aotInitializers.add(initializer);
} }
initializers.removeAll(aotInitializers); initializers.removeAll(aotInitializers);
initializers.addAll(0, aotInitializers); initializers.addAll(0, aotInitializers);

Loading…
Cancel
Save