ApplicationContextAotGenerator.generateApplicationContext does not actually generate an ApplicationContext. Rather it processes an ApplicationContext for AOT and generates an ApplicationContextInitializer. Thus, the current name of the method is confusing and a bit misleading.

As suggested by @philwebb:

It could be renamed to processAheadOfTime(...) much like the BeanRegistrationAotProcessor.

Another option might be to return something other than a ClassName, perhaps an AotProcessedApplicationContext (or similar) which has a getter for the initializer.

The latter would allow the method to return additional information over time if necessary.

Comment From: snicoll

and generates an ApplicationContextInitializer.

FTR, it doesn't do only that. Participants can write code that optimize other things. I like processAheadOfTime.