Adapt to API change in Spring Framework

See https://github.com/spring-projects/spring-framework/issues/28927
This commit is contained in:
Stephane Nicoll
2022-08-05 10:39:36 +02:00
parent 36cf3b9f78
commit 1af5994d8f
4 changed files with 4 additions and 6 deletions

View File

@@ -163,7 +163,7 @@ class ChildManagementContextInitializer
public void applyTo(GenerationContext generationContext, BeanRegistrationCode beanRegistrationCode) {
GenerationContext managementGenerationContext = generationContext.withName("Management");
ClassName generatedInitializerClassName = new ApplicationContextAotGenerator()
.generateApplicationContext(this.managementContext, managementGenerationContext);
.processAheadOfTime(this.managementContext, managementGenerationContext);
GeneratedMethod postProcessorMethod = beanRegistrationCode.getMethods().add("addManagementInitializer",
(method) -> method.addJavadoc("Use AOT management context initialization")
.addModifiers(Modifier.PRIVATE, Modifier.STATIC)

View File

@@ -75,7 +75,7 @@ class ChildManagementContextInitializerAotTests {
EndpointAutoConfiguration.class));
contextRunner.withPropertyValues("server.port=0", "management.server.port=0").prepare((context) -> {
TestGenerationContext generationContext = new TestGenerationContext(TestTarget.class);
ClassName className = new ApplicationContextAotGenerator().generateApplicationContext(
ClassName className = new ApplicationContextAotGenerator().processAheadOfTime(
(GenericApplicationContext) context.getSourceApplicationContext(), generationContext);
generationContext.writeGeneratedContent();
TestCompiler compiler = TestCompiler.forSystem();

View File

@@ -147,8 +147,7 @@ public class AotProcessor {
DefaultGenerationContext generationContext = new DefaultGenerationContext(
new ClassNameGenerator(this.application), generatedFiles);
ApplicationContextAotGenerator generator = new ApplicationContextAotGenerator();
ClassName generatedInitializerClassName = generator.generateApplicationContext(applicationContext,
generationContext);
ClassName generatedInitializerClassName = generator.processAheadOfTime(applicationContext, generationContext);
registerEntryPointHint(generationContext, generatedInitializerClassName);
generationContext.writeGeneratedContent();
writeHints(generationContext.getRuntimeHints());

View File

@@ -143,8 +143,7 @@ class ConfigurationPropertiesBeanRegistrationAotProcessorTests {
@SuppressWarnings("unchecked")
private void compile(GenericApplicationContext context, Consumer<GenericApplicationContext> freshContext) {
TestGenerationContext generationContext = new TestGenerationContext(TestTarget.class);
ClassName className = new ApplicationContextAotGenerator().generateApplicationContext(context,
generationContext);
ClassName className = new ApplicationContextAotGenerator().processAheadOfTime(context, generationContext);
generationContext.writeGeneratedContent();
TestCompiler.forSystem().withFiles(generationContext.getGeneratedFiles()).compile((compiled) -> {
GenericApplicationContext freshApplicationContext = new GenericApplicationContext();