Spring Cloud Config client + AOT not build
Hello, I have a sample project in Spring boot/cloud + Cloud Config client
spring-boot-dependencies : 3.5.0 spring-cloud-dependencies : 2025.0.0 jdk: 24
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>it.marcoberri</groupId>
<artifactId>my-parent</artifactId>
<version>2.2.0-release</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<artifactId>poc</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>aot</name>
<description>Aot</description>
<url/>
<licenses>
<license/>
</licenses>
<developers>
<developer/>
</developers>
<scm>
<connection/>
<developerConnection/>
<tag/>
<url/>
</scm>
<properties>
<java.version>24</java.version>
</properties>
<dependencies>
<!-- STARTED + JETTY -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<!-- Exclude the Tomcat dependency -->
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Use Jetty instead -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
<!-- EUREKA CLIENT -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<!-- Actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- TEST CLASS -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>3.5.0</version>
<executions>
<execution>
<id>repackage</id>
<goals>
<goal>repackage</goal>
</goals>
</execution>
<execution>
<id>process-aot</id>
<goals>
<goal>process-aot</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>it.marcoberri</groupId>
<artifactId>my-parent</artifactId>
<version>2.2.0-release</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<artifactId>poc</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>aot</name>
<description>Aot</description>
<url/>
<licenses>
<license/>
</licenses>
<developers>
<developer/>
</developers>
<scm>
<connection/>
<developerConnection/>
<tag/>
<url/>
</scm>
<properties>
<java.version>24</java.version>
</properties>
<dependencies>
<!-- STARTED + JETTY -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<!-- Exclude the Tomcat dependency -->
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Use Jetty instead -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
<!-- config-server -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
<!-- Actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- TEST CLASS -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/*.properties</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<includes>
<include>**/certificate/*.p12</include>
</includes>
</resource>
<resource>
<directory>target/classes/META-INF/sbom</directory>
<includes>
<include>**/*.json</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>3.5.0</version>
<executions>
<execution>
<id>repackage</id>
<goals>
<goal>repackage</goal>
</goals>
</execution>
<execution>
<id>process-aot</id>
<goals>
<goal>process-aot</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
my parent pom
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>it.marcoberri</groupId>
<artifactId>my-parent</artifactId>
<version>2.2.0-release</version>
<packaging>pom</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<!-- Java -->
<java.version>24</java.version>
<maven.compiler.release>24</maven.compiler.release>
<maven.compiler.source>24</maven.compiler.source>
<maven.compiler.target>24</maven.compiler.target>
<!-- Plugin -->
<maven-gpg-plugin.version>3.2.7</maven-gpg-plugin.version>
<maven-surefire-plugin.version>3.5.3</maven-surefire-plugin.version>
<maven-compiler-plugin.version>3.14.0</maven-compiler-plugin.version>
<maven-source-plugin.version>3.3.1</maven-source-plugin.version>
<maven-enforcer-plugin.version>3.5.0</maven-enforcer-plugin.version>
<lombok.version>1.18.38</lombok.version>
</properties>
<dependencyManagement>
<dependencies>
<!-- Spring Boot dependencies -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>3.5.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- Spring Cloud dependencies -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>2025.0.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>33.4.8-jre</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcutil-jdk18on</artifactId>
<version>1.80</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
Application is very simple
@SpringBootApplication
public class AotApplication {
public static void main(String[] args) {
SpringApplication.run(AotApplication.class, args);
}
}
application.properties
################################################
# SERVER #
################################################
#override with desired HTTP port (remember to synch this value with docker port)
server.port=9069
#additional HTTP port (will open it in SpringConfiguration)
server.http.port=8069
#override with desired name
spring.application.name=eipam
spring.main.banner-mode=off
server.shutdown=graceful
server.error.include-message=always
server.error.include-binding-errors=always
############################################
# ACTUATOR
############################################
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
management.endpoint.loggers.enabled=true
management.httpexchanges.recording.include=RESPONSE_HEADERS
management.endpoint.httptrace.enabled=true
management.endpoint.env.show-values=ALWAYS
management.endpoint.configprops.show-values=ALWAYS
management.info.env.enabled=true
management.observations.key-values.application=${spring.application.name}
############################################
# CONFIG SERVER
############################################
spring.config.import=optional:configserver:
mvn "-Dmaven.test.skip=true" clean package
is ok
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 40.370 s
[INFO] Finished at: 2025-06-09T12:15:45+02:00
[INFO] ------------------------------------------------------------------------
java -Djarmode=tools -jar target/poc-0.0.1-SNAPSHOT.jar extract --destination application
is ok
cd application
java "-Dspring.profiles.active=local" "-XX:AOTMode=record" "-XX:AOTConfiguration=app.aotconf" "-Dspring.context.exit=onRefresh" -jar .\poc-0.0.1-SNAPSHOT.jar
is ok, last log
java "-Dspring.profiles.active=local" "-XX:AOTMode=create" "-XX:AOTConfiguration=app.aotconf" "-XX:AOTCache=app.aot" -jar .\poc-0.0.1-SNAPSHOT.jar
Not Build!
[41.415s][error ][cds,heap] Scanned 103932 objects. Found 105 case(s) where an object points to a static field that may hold a different value at runtime.
[41.415s][error ][cds ] An error has occurred while writing the shared archive file.
Can you please provide a sample as a zip file or github repo that reproduces the issue?
Did you check this ref? https://github.com/spring-cloud/spring-cloud-config/blob/4b2193f8cf8b0ae6edcc93cc22c06c781a734890/docs/modules/ROOT/pages/client.adoc#L155
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.