Skip to content

Commit 30d7af4

Browse files
committed
Add CI with Java 24
Closes gh-44205
1 parent b8f6468 commit 30d7af4

File tree

6 files changed

+41
-3
lines changed

6 files changed

+41
-3
lines changed

.github/workflows/ci.yml

+3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ jobs:
2525
toolchain: false
2626
- version: 23
2727
toolchain: true
28+
- version: 24
29+
early-access: true
30+
toolchain: true
2831
exclude:
2932
- os:
3033
name: Linux

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/build.gradle

+4
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,7 @@ plugins.withType(EclipsePlugin) {
154154
}
155155
}
156156
}
157+
158+
toolchain {
159+
maximumCompatibleJavaVersion = JavaLanguageVersion.of(23)
160+
}

spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServerFactoryTests.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -44,6 +44,8 @@
4444
import org.junit.jupiter.api.AfterEach;
4545
import org.junit.jupiter.api.Disabled;
4646
import org.junit.jupiter.api.Test;
47+
import org.junit.jupiter.api.condition.DisabledForJreRange;
48+
import org.junit.jupiter.api.condition.JRE;
4749
import org.mockito.InOrder;
4850

4951
import org.springframework.boot.testsupport.web.servlet.ExampleServlet;
@@ -308,6 +310,7 @@ void sslRestrictedProtocolsECDHESuccess() throws Exception {
308310
}
309311

310312
@Test
313+
@DisabledForJreRange(min = JRE.JAVA_24)
311314
void sslRestrictedProtocolsRSATLS12Success() throws Exception {
312315
testRestrictedSSLProtocolsAndCipherSuites(new String[] { "TLSv1.2" },
313316
new String[] { "TLS_RSA_WITH_AES_128_CBC_SHA256" });

spring-boot-system-tests/spring-boot-image-tests/build.gradle

+4
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,7 @@ dependencies {
4242
systemTestImplementation("org.testcontainers:junit-jupiter")
4343
systemTestImplementation("org.testcontainers:testcontainers")
4444
}
45+
46+
toolchain {
47+
maximumCompatibleJavaVersion = JavaLanguageVersion.of(23)
48+
}

spring-boot-tests/spring-boot-integration-tests/spring-boot-loader-classic-tests/src/dockerTest/java/org/springframework/boot/loader/LoaderIntegrationTests.java

+13-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,18 @@ private GenericContainer<?> createContainer(JavaRuntime javaRuntime) {
6767
.withLogConsumer(this.output)
6868
.withCopyFileToContainer(MountableFile.forHostPath(findApplication().toPath()), "/app.jar")
6969
.withStartupCheckStrategy(new OneShotStartupCheckStrategy().withTimeout(Duration.ofMinutes(5)))
70-
.withCommand("java", "-jar", "app.jar");
70+
.withCommand(command(javaRuntime));
71+
}
72+
73+
private String[] command(JavaRuntime javaRuntime) {
74+
List<String> command = new ArrayList<>();
75+
command.add("java");
76+
if (javaRuntime.version == JavaVersion.TWENTY_FOUR) {
77+
command.add("--enable-native-access=ALL-UNNAMED");
78+
}
79+
command.add("-jar");
80+
command.add("app.jar");
81+
return command.toArray(new String[0]);
7182
}
7283

7384
private File findApplication() {
@@ -84,6 +95,7 @@ static Stream<JavaRuntime> javaRuntimes() {
8495
javaRuntimes.add(JavaRuntime.oracleJdk17());
8596
javaRuntimes.add(JavaRuntime.openJdk(JavaVersion.TWENTY_TWO));
8697
javaRuntimes.add(JavaRuntime.openJdk(JavaVersion.TWENTY_THREE));
98+
javaRuntimes.add(JavaRuntime.openJdkEarlyAccess(JavaVersion.TWENTY_FOUR));
8799
return javaRuntimes.stream().filter(JavaRuntime::isCompatible);
88100
}
89101

spring-boot-tests/spring-boot-integration-tests/spring-boot-loader-tests/src/dockerTest/java/org/springframework/boot/loader/LoaderIntegrationTests.java

+13-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,18 @@ private GenericContainer<?> createContainer(JavaRuntime javaRuntime, String name
9090
.withLogConsumer(this.output)
9191
.withCopyFileToContainer(findApplication(name, classifier), "/app.jar")
9292
.withStartupCheckStrategy(new OneShotStartupCheckStrategy().withTimeout(Duration.ofMinutes(5)))
93-
.withCommand("java", "-jar", "app.jar");
93+
.withCommand(command(javaRuntime));
94+
}
95+
96+
private String[] command(JavaRuntime javaRuntime) {
97+
List<String> command = new ArrayList<>();
98+
command.add("java");
99+
if (javaRuntime.version == JavaVersion.TWENTY_FOUR) {
100+
command.add("--enable-native-access=ALL-UNNAMED");
101+
}
102+
command.add("-jar");
103+
command.add("app.jar");
104+
return command.toArray(new String[0]);
94105
}
95106

96107
private MountableFile findApplication(String name, String classifier) {
@@ -112,6 +123,7 @@ static Stream<JavaRuntime> javaRuntimes() {
112123
javaRuntimes.add(JavaRuntime.oracleJdk17());
113124
javaRuntimes.add(JavaRuntime.openJdk(JavaVersion.TWENTY_TWO));
114125
javaRuntimes.add(JavaRuntime.openJdk(JavaVersion.TWENTY_THREE));
126+
javaRuntimes.add(JavaRuntime.openJdkEarlyAccess(JavaVersion.TWENTY_FOUR));
115127
return javaRuntimes.stream().filter(JavaRuntime::isCompatible);
116128
}
117129

0 commit comments

Comments
 (0)