Skip to content

Spring Data AOT Repositories failed in the AOT processed Spring Boot tests with multiple contexts being involved #3339

@mipo256

Description

@mipo256

This issue originates from this Spring Boot ticket. Stéphane stated that this issue should be re-opened here, so I did.

The full story behind the question can be read in the original ticket, but the idea is that when in Spring Boot tests we have multiple versions of cached contexts being build, then AOT generation engine fails with exception:

Caused by: java.lang.IllegalStateException: /home/user/OpenSource/spring-petclinic/target/spring-aot/test/sources/org/springframework/samples/petclinic/owner/OwnerRepositoryImpl__Aot.java already exists
	at org.springframework.aot.generate.GeneratedFiles$FileHandler.create(GeneratedFiles.java:279)
	at org.springframework.aot.generate.GeneratedFiles.lambda$addFile$1(GeneratedFiles.java:170)

We concluded, that this is probably because for each test context, the engine tries to re-generate the Spring Data AOT repositories fragments.

Small addition: I tend to believe the conclusion, since when I've ensured that only one test context is created in Spring PetClinic, then AOT generation goes just fine (including AOT Repositories). Here is the branch in Spring PetClinic's fork that've used for this small testing purposes.

I'm willing to contribute, if core team would allow.

CC: @odrotbohm @mp911de

Metadata

Metadata

Labels

status: waiting-for-triageAn issue we've not yet triagedtheme: aotAn issue related to Ahead-Of-Time processing

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions