diff --git a/spring-test/src/main/java/org/springframework/test/context/aot/TestContextAotGenerator.java b/spring-test/src/main/java/org/springframework/test/context/aot/TestContextAotGenerator.java index 3629af2d49ad..4cce32599b96 100644 --- a/spring-test/src/main/java/org/springframework/test/context/aot/TestContextAotGenerator.java +++ b/spring-test/src/main/java/org/springframework/test/context/aot/TestContextAotGenerator.java @@ -227,7 +227,7 @@ private MultiValueMap> processAheadOfTime( } catch (Exception ex) { if (this.failOnError) { - throw new IllegalStateException("Failed to generate AOT artifacts for test classes " + + throw new TestContextAotException("Failed to generate AOT artifacts for test classes " + testClasses.stream().map(Class::getName).toList(), ex); } if (logger.isDebugEnabled()) {