mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-28 18:19:05 +00:00
Introduce BeanFactoryInitializationCode#getClassName
See gh-35803
This commit is contained in:
+9
@@ -18,6 +18,7 @@ package org.springframework.beans.factory.aot;
|
||||
|
||||
import org.springframework.aot.generate.GeneratedMethods;
|
||||
import org.springframework.aot.generate.MethodReference;
|
||||
import org.springframework.javapoet.ClassName;
|
||||
|
||||
/**
|
||||
* Interface that can be used to configure the code that will be generated to
|
||||
@@ -25,6 +26,7 @@ import org.springframework.aot.generate.MethodReference;
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @author Stephane Nicoll
|
||||
* @author Sebastien Deleuze
|
||||
* @since 6.0
|
||||
* @see BeanFactoryInitializationAotContribution
|
||||
*/
|
||||
@@ -41,6 +43,13 @@ public interface BeanFactoryInitializationCode {
|
||||
*/
|
||||
GeneratedMethods getMethods();
|
||||
|
||||
/**
|
||||
* Return the name of the class used by the initializing code.
|
||||
* @return the generated class name
|
||||
* @since 7.0.2
|
||||
*/
|
||||
ClassName getClassName();
|
||||
|
||||
/**
|
||||
* Add an initializer method call. An initializer can use a flexible signature,
|
||||
* using any of the following:
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ public class ApplicationContextAotGenerator {
|
||||
new ApplicationContextInitializationCodeGenerator(applicationContext, generationContext);
|
||||
DefaultListableBeanFactory beanFactory = applicationContext.getDefaultListableBeanFactory();
|
||||
new BeanFactoryInitializationAotContributions(beanFactory).applyTo(generationContext, codeGenerator);
|
||||
return codeGenerator.getGeneratedClass().getName();
|
||||
return codeGenerator.getClassName();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -127,8 +127,9 @@ class ApplicationContextInitializationCodeGenerator implements BeanFactoryInitia
|
||||
return ArgumentCodeGenerator.from(new InitializerMethodArgumentCodeGenerator());
|
||||
}
|
||||
|
||||
GeneratedClass getGeneratedClass() {
|
||||
return this.generatedClass;
|
||||
@Override
|
||||
public ClassName getClassName() {
|
||||
return this.generatedClass.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user