Skip to content

Commit c20599a

Browse files
committed
Merge pull request #44266 from ngocnhan-tran1996
* pr/44266: Implement RuntimeHintsRegistrar Closes gh-44266
2 parents d9c5431 + e982136 commit c20599a

File tree

3 files changed

+17
-18
lines changed

3 files changed

+17
-18
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerTemplateAvailabilityProvider.java

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 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.
@@ -21,6 +21,7 @@
2121
import java.util.List;
2222

2323
import org.springframework.aot.hint.RuntimeHints;
24+
import org.springframework.aot.hint.RuntimeHintsRegistrar;
2425
import org.springframework.boot.autoconfigure.template.PathBasedTemplateAvailabilityProvider;
2526
import org.springframework.boot.autoconfigure.template.TemplateAvailabilityProvider;
2627
import org.springframework.boot.context.properties.bind.BindableRuntimeHintsRegistrar;
@@ -65,16 +66,13 @@ public void setTemplateLoaderPath(List<String> templateLoaderPath) {
6566

6667
}
6768

68-
static class FreeMarkerTemplateAvailabilityRuntimeHints extends BindableRuntimeHintsRegistrar {
69-
70-
FreeMarkerTemplateAvailabilityRuntimeHints() {
71-
super(FreeMarkerTemplateAvailabilityProperties.class);
72-
}
69+
static class FreeMarkerTemplateAvailabilityRuntimeHints implements RuntimeHintsRegistrar {
7370

7471
@Override
7572
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
7673
if (ClassUtils.isPresent(REQUIRED_CLASS_NAME, classLoader)) {
77-
super.registerHints(hints, classLoader);
74+
BindableRuntimeHintsRegistrar.forTypes(FreeMarkerTemplateAvailabilityProperties.class)
75+
.registerHints(hints, classLoader);
7876
}
7977
}
8078

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAvailabilityProvider.java

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 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.
@@ -21,6 +21,7 @@
2121
import java.util.List;
2222

2323
import org.springframework.aot.hint.RuntimeHints;
24+
import org.springframework.aot.hint.RuntimeHintsRegistrar;
2425
import org.springframework.boot.autoconfigure.template.PathBasedTemplateAvailabilityProvider;
2526
import org.springframework.boot.autoconfigure.template.TemplateAvailabilityProvider;
2627
import org.springframework.boot.context.properties.bind.BindableRuntimeHintsRegistrar;
@@ -65,16 +66,13 @@ public void setResourceLoaderPath(List<String> resourceLoaderPath) {
6566

6667
}
6768

68-
static class GroovyTemplateAvailabilityRuntimeHints extends BindableRuntimeHintsRegistrar {
69-
70-
GroovyTemplateAvailabilityRuntimeHints() {
71-
super(GroovyTemplateAvailabilityProperties.class);
72-
}
69+
static class GroovyTemplateAvailabilityRuntimeHints implements RuntimeHintsRegistrar {
7370

7471
@Override
7572
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
7673
if (ClassUtils.isPresent(REQUIRED_CLASS_NAME, classLoader)) {
77-
super.registerHints(hints, classLoader);
74+
BindableRuntimeHintsRegistrar.forTypes(GroovyTemplateAvailabilityProperties.class)
75+
.registerHints(hints, classLoader);
7876
}
7977
}
8078

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/http/HttpMessageConvertersAutoConfiguration.java

+7-4
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.
@@ -16,6 +16,8 @@
1616

1717
package org.springframework.boot.autoconfigure.http;
1818

19+
import org.springframework.aot.hint.RuntimeHints;
20+
import org.springframework.aot.hint.RuntimeHintsRegistrar;
1921
import org.springframework.beans.factory.ObjectProvider;
2022
import org.springframework.boot.autoconfigure.AutoConfiguration;
2123
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@@ -100,10 +102,11 @@ private static final class ReactiveWebApplication {
100102

101103
}
102104

103-
static class HttpMessageConvertersAutoConfigurationRuntimeHints extends BindableRuntimeHintsRegistrar {
105+
static class HttpMessageConvertersAutoConfigurationRuntimeHints implements RuntimeHintsRegistrar {
104106

105-
HttpMessageConvertersAutoConfigurationRuntimeHints() {
106-
super(Encoding.class);
107+
@Override
108+
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
109+
BindableRuntimeHintsRegistrar.forTypes(Encoding.class).registerHints(hints, classLoader);
107110
}
108111

109112
}

0 commit comments

Comments
 (0)