Skip to content

Commit 853caf9

Browse files
committed
Do not exclude DevTools from Maven AOT processing classpath
When excluded from the AOT processing classpath, a reflection hint for DevTools' RestartScopeInitializer that's registered in spring.factories is not generated. When the native image is compiled we have no control over its classpath so DevTools is included. This causes a failure at runtime as RestartScopeInitializer cannot be loaded due to the missing reflection hint. Until we have control over the native image classpath, we need to include DevTools on the AOT processing classpath and then rely on DevTools disabling itself in a native image which it already does. Fixes gh-35853
1 parent 9a2b9cb commit 853caf9

File tree

2 files changed

+1
-3
lines changed
  • spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src

2 files changed

+1
-3
lines changed

spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/aot-development-only-exclusions/src/main/java/org/test/SampleApplication.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
public class SampleApplication {
2626

2727
public static void main(String[] args) {
28-
Assert.state(!ClassUtils.isPresent("org.springframework.boot.devtools.autoconfigure.DevToolsProperties", null), "Should not have devtools");
2928
Assert.state(!ClassUtils.isPresent("org.springframework.boot.docker.compose.core.DockerCompose", null), "Should not have docker-compose");
3029
SpringApplication.run(SampleApplication.class, args);
3130
}

spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/ProcessAotMojo.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,7 @@ private String[] getAotArguments(String applicationClass) {
111111

112112
private URL[] getClassPath() throws Exception {
113113
File[] directories = new File[] { this.classesDirectory, this.generatedClasses };
114-
return getClassPath(directories, new ExcludeTestScopeArtifactFilter(), DEVTOOLS_EXCLUDE_FILTER,
115-
DOCKER_COMPOSE_EXCLUDE_FILTER);
114+
return getClassPath(directories, new ExcludeTestScopeArtifactFilter(), DOCKER_COMPOSE_EXCLUDE_FILTER);
116115
}
117116

118117
private RunArguments resolveArguments() {

0 commit comments

Comments
 (0)