Polishing

This commit is contained in:
Sam Brannen
2022-08-05 11:54:03 +03:00
parent 2cc4486e3d
commit 853407b6f8
3 changed files with 41 additions and 66 deletions

View File

@@ -36,13 +36,14 @@ import org.springframework.javapoet.ClassName;
public class ApplicationContextAotGenerator {
/**
* Process the specified {@link GenericApplicationContext} instance
* ahead-of-time using the specified {@link GenerationContext}.
* Process the specified {@link GenericApplicationContext} ahead-of-time using
* the specified {@link GenerationContext}.
* <p>Return the {@link ClassName} of the {@link ApplicationContextInitializer}
* to use to restore an optimized state of the application context.
* @param applicationContext the non-refreshed application context to handle
* @param applicationContext the non-refreshed application context to process
* @param generationContext the generation context to use
* @return the class name of the {@link ApplicationContextInitializer} entry point
* @return the {@code ClassName} of the {@code ApplicationContextInitializer}
* entry point
*/
public ClassName processAheadOfTime(GenericApplicationContext applicationContext,
GenerationContext generationContext) {

View File

@@ -36,13 +36,12 @@ import org.springframework.javapoet.ParameterizedTypeName;
import org.springframework.javapoet.TypeSpec;
/**
* Internal code generator to create the application context initializer.
* Internal code generator to create the {@link ApplicationContextInitializer}.
*
* @author Phillip Webb
* @since 6.0
*/
class ApplicationContextInitializationCodeGenerator
implements BeanFactoryInitializationCode {
class ApplicationContextInitializationCodeGenerator implements BeanFactoryInitializationCode {
private static final String INITIALIZE_METHOD = "initialize";
@@ -70,13 +69,11 @@ class ApplicationContextInitializationCodeGenerator
type.addMethod(generateInitializeMethod());
}
private MethodSpec generateInitializeMethod() {
MethodSpec.Builder method = MethodSpec.methodBuilder(INITIALIZE_METHOD);
method.addAnnotation(Override.class);
method.addModifiers(Modifier.PUBLIC);
method.addParameter(GenericApplicationContext.class,
APPLICATION_CONTEXT_VARIABLE);
method.addParameter(GenericApplicationContext.class, APPLICATION_CONTEXT_VARIABLE);
method.addCode(generateInitializeCode());
return method.build();
}