Skip to content

Commit 0c7e49e

Browse files
committed
Merge branch '3.5.x'
Closes gh-47621
2 parents 9bd5c1a + 8a1acee commit 0c7e49e

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

core/spring-boot/src/main/java/org/springframework/boot/system/JavaVersion.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
import java.util.SortedSet;
2727
import java.util.concurrent.Future;
2828

29+
import org.jspecify.annotations.Nullable;
30+
31+
import org.springframework.aot.hint.RuntimeHints;
32+
import org.springframework.aot.hint.RuntimeHintsRegistrar;
2933
import org.springframework.util.ClassUtils;
3034

3135
/**
@@ -96,8 +100,11 @@ public enum JavaVersion {
96100

97101
private final boolean available;
98102

103+
private final Class<?> versionSpecificClass;
104+
99105
JavaVersion(String name, Class<?> versionSpecificClass, String versionSpecificMethod, Class<?>... paramTypes) {
100106
this.name = name;
107+
this.versionSpecificClass = versionSpecificClass;
101108
this.available = ClassUtils.hasMethod(versionSpecificClass, versionSpecificMethod, paramTypes);
102109
}
103110

@@ -139,4 +146,15 @@ public boolean isOlderThan(JavaVersion version) {
139146
return compareTo(version) < 0;
140147
}
141148

149+
static class Hints implements RuntimeHintsRegistrar {
150+
151+
@Override
152+
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
153+
for (JavaVersion javaVersion : JavaVersion.values()) {
154+
hints.reflection().registerType(javaVersion.versionSpecificClass);
155+
}
156+
}
157+
158+
}
159+
142160
}

core/spring-boot/src/main/resources/META-INF/spring/aot.factories

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ org.springframework.boot.logging.log4j2.Log4J2RuntimeHints,\
1010
org.springframework.boot.logging.logback.LogbackRuntimeHints,\
1111
org.springframework.boot.logging.structured.ElasticCommonSchemaProperties$ElasticCommonSchemaPropertiesRuntimeHints,\
1212
org.springframework.boot.logging.structured.GraylogExtendedLogFormatProperties$GraylogExtendedLogFormatPropertiesRuntimeHints,\
13-
org.springframework.boot.logging.structured.StructuredLoggingJsonProperties$StructuredLoggingJsonPropertiesRuntimeHints
13+
org.springframework.boot.logging.structured.StructuredLoggingJsonProperties$StructuredLoggingJsonPropertiesRuntimeHints,\
14+
org.springframework.boot.system.JavaVersion$Hints
1415

1516
org.springframework.beans.factory.aot.BeanFactoryInitializationAotProcessor=\
1617
org.springframework.boot.context.properties.ConfigurationPropertiesBeanFactoryInitializationAotProcessor,\

0 commit comments

Comments
 (0)