Affects: 6.0

During test AOT processing, each merged context configuration results in a new initializer being generated. These initializers provide separation for the code that's required to bootstrap the AOT-processed context. When an AOT contribution adds files to the generated context (generationContext.getGeneratedFiles().addResourceFile(…) for example), no such separation occurs. As seen in this Spring Boot issue, this can lead to clashes as files from AOT processing of an earlier merged context configuration are overwritten by processing of a subsequent merged context configuration.

I think we need a way to separate the files that are generated during AOT processing so that they're isolated on a per-context basis. This would need to work both on the writing side when files are being generated during AOT processing and on the reading side when those generated files are being consumed at runtime when the AOT processed context is refreshed.

Comment From: snicoll

We've been working on an API that would handle those clashes and return a ResourceReference that can generate the code to get back a Spring's Resource as MethodReference does for methods. Unfortunately, that didn't help very much as the use case is outside of Spring and all that's required really is to make sure that the model that is generated is the same as the one that was already generated, if any.

This issue is requalified to an advanced API in GeneratedFiles that provides a callback that let the caller determine what they want to do in case the file already exists.