Browse Source

Adapt to API change in Spring Framework

See https://github.com/spring-projects/spring-framework/issues/28927
pull/31997/head
Stephane Nicoll 4 years ago
parent
commit
1af5994d8f
  1. 2
      spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/ChildManagementContextInitializer.java
  2. 2
      spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/server/ChildManagementContextInitializerAotTests.java
  3. 3
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/AotProcessor.java
  4. 3
      spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBeanRegistrationAotProcessorTests.java

2
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/ChildManagementContextInitializer.java

@ -163,7 +163,7 @@ class ChildManagementContextInitializer @@ -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)

2
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/server/ChildManagementContextInitializerAotTests.java

@ -75,7 +75,7 @@ class ChildManagementContextInitializerAotTests { @@ -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();

3
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/AotProcessor.java

@ -147,8 +147,7 @@ public class AotProcessor { @@ -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());

3
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBeanRegistrationAotProcessorTests.java

@ -143,8 +143,7 @@ class ConfigurationPropertiesBeanRegistrationAotProcessorTests { @@ -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();

Loading…
Cancel
Save