Use Application as target for generated code

Closes gh-31274
pull/31304/head
Stephane Nicoll 2 years ago
parent ab93bc26c7
commit e30391ca7a

@ -147,7 +147,8 @@ public class AotProcessor {
ApplicationContextAotGenerator generator = new ApplicationContextAotGenerator(); ApplicationContextAotGenerator generator = new ApplicationContextAotGenerator();
ClassName generatedInitializerClassName = generationContext.getClassNameGenerator() ClassName generatedInitializerClassName = generationContext.getClassNameGenerator()
.generateClassName(this.application, "ApplicationContextInitializer"); .generateClassName(this.application, "ApplicationContextInitializer");
generator.generateApplicationContext(applicationContext, generationContext, generatedInitializerClassName); generator.generateApplicationContext(applicationContext, this.application, "", generationContext,
generatedInitializerClassName);
registerEntryPointHint(generationContext, generatedInitializerClassName); registerEntryPointHint(generationContext, generatedInitializerClassName);
generationContext.writeGeneratedContent(); generationContext.writeGeneratedContent();
writeHints(generationContext.getRuntimeHints()); writeHints(generationContext.getRuntimeHints());

@ -109,6 +109,12 @@ class AotProcessorTests {
assertThat(directory.resolve( assertThat(directory.resolve(
"source/org/springframework/boot/AotProcessorTests_SampleApplication__ApplicationContextInitializer.java")) "source/org/springframework/boot/AotProcessorTests_SampleApplication__ApplicationContextInitializer.java"))
.exists().isRegularFile(); .exists().isRegularFile();
assertThat(directory.resolve(
"source/org/springframework/boot/AotProcessorTests_SampleApplication__BeanDefinitions.java"))
.exists().isRegularFile();
assertThat(directory.resolve(
"source/org/springframework/boot/AotProcessorTests_SampleApplication__BeanFactoryRegistrations.java"))
.exists().isRegularFile();
assertThat(directory.resolve("resource/META-INF/native-image/com.example/example/reflect-config.json")) assertThat(directory.resolve("resource/META-INF/native-image/com.example/example/reflect-config.json"))
.exists().isRegularFile(); .exists().isRegularFile();
Path nativeImagePropertiesFile = directory Path nativeImagePropertiesFile = directory

Loading…
Cancel
Save