Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement RuntimeHintsRegistrar #44266

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -21,6 +21,7 @@
import java.util.List;

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

}

static class FreeMarkerTemplateAvailabilityRuntimeHints extends BindableRuntimeHintsRegistrar {

FreeMarkerTemplateAvailabilityRuntimeHints() {
super(FreeMarkerTemplateAvailabilityProperties.class);
}
static class FreeMarkerTemplateAvailabilityRuntimeHints implements RuntimeHintsRegistrar {

@Override
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
if (ClassUtils.isPresent(REQUIRED_CLASS_NAME, classLoader)) {
super.registerHints(hints, classLoader);
BindableRuntimeHintsRegistrar.forTypes(FreeMarkerTemplateAvailabilityProperties.class)
.registerHints(hints, classLoader);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -21,6 +21,7 @@
import java.util.List;

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

}

static class GroovyTemplateAvailabilityRuntimeHints extends BindableRuntimeHintsRegistrar {

GroovyTemplateAvailabilityRuntimeHints() {
super(GroovyTemplateAvailabilityProperties.class);
}
static class GroovyTemplateAvailabilityRuntimeHints implements RuntimeHintsRegistrar {

@Override
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
if (ClassUtils.isPresent(REQUIRED_CLASS_NAME, classLoader)) {
super.registerHints(hints, classLoader);
BindableRuntimeHintsRegistrar.forTypes(GroovyTemplateAvailabilityProperties.class)
.registerHints(hints, classLoader);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,6 +16,8 @@

package org.springframework.boot.autoconfigure.http;

import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.RuntimeHintsRegistrar;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
Expand Down Expand Up @@ -100,10 +102,11 @@ private static final class ReactiveWebApplication {

}

static class HttpMessageConvertersAutoConfigurationRuntimeHints extends BindableRuntimeHintsRegistrar {
static class HttpMessageConvertersAutoConfigurationRuntimeHints implements RuntimeHintsRegistrar {

HttpMessageConvertersAutoConfigurationRuntimeHints() {
super(Encoding.class);
@Override
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
BindableRuntimeHintsRegistrar.forTypes(Encoding.class).registerHints(hints, classLoader);
}

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,6 +19,8 @@
import java.util.LinkedHashSet;
import java.util.Set;

import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.RuntimeHintsRegistrar;
import org.springframework.boot.Banner.Mode;
import org.springframework.boot.context.properties.bind.BindableRuntimeHintsRegistrar;
import org.springframework.boot.logging.LoggingSystemProperty;
Expand Down Expand Up @@ -157,10 +159,11 @@ void setWebApplicationType(WebApplicationType webApplicationType) {
this.webApplicationType = webApplicationType;
}

static class ApplicationPropertiesRuntimeHints extends BindableRuntimeHintsRegistrar {
static class ApplicationPropertiesRuntimeHints implements RuntimeHintsRegistrar {

ApplicationPropertiesRuntimeHints() {
super(ApplicationProperties.class);
@Override
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
BindableRuntimeHintsRegistrar.forTypes(ApplicationProperties.class).registerHints(hints, classLoader);
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package org.springframework.boot.logging.structured;

import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.RuntimeHintsRegistrar;
import org.springframework.boot.context.properties.bind.BindableRuntimeHintsRegistrar;
import org.springframework.boot.context.properties.bind.Binder;
import org.springframework.boot.json.JsonWriter;
Expand Down Expand Up @@ -92,10 +94,12 @@ Service withDefaults(Environment environment) {

}

static class ElasticCommonSchemaPropertiesRuntimeHints extends BindableRuntimeHintsRegistrar {
static class ElasticCommonSchemaPropertiesRuntimeHints implements RuntimeHintsRegistrar {

ElasticCommonSchemaPropertiesRuntimeHints() {
super(ElasticCommonSchemaProperties.class);
@Override
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
BindableRuntimeHintsRegistrar.forTypes(ElasticCommonSchemaProperties.class)
.registerHints(hints, classLoader);
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package org.springframework.boot.logging.structured;

import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.RuntimeHintsRegistrar;
import org.springframework.boot.context.properties.bind.BindableRuntimeHintsRegistrar;
import org.springframework.boot.context.properties.bind.Binder;
import org.springframework.boot.json.JsonWriter;
Expand Down Expand Up @@ -92,10 +94,12 @@ void jsonMembers(JsonWriter.Members<?> members) {

}

static class GraylogExtendedLogFormatPropertiesRuntimeHints extends BindableRuntimeHintsRegistrar {
static class GraylogExtendedLogFormatPropertiesRuntimeHints implements RuntimeHintsRegistrar {

GraylogExtendedLogFormatPropertiesRuntimeHints() {
super(GraylogExtendedLogFormatProperties.class);
@Override
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
BindableRuntimeHintsRegistrar.forTypes(GraylogExtendedLogFormatProperties.class)
.registerHints(hints, classLoader);
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import java.util.function.UnaryOperator;
import java.util.stream.Stream;

import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.RuntimeHintsRegistrar;
import org.springframework.boot.context.properties.PropertyMapper;
import org.springframework.boot.context.properties.bind.BindableRuntimeHintsRegistrar;
import org.springframework.boot.context.properties.bind.Binder;
Expand Down Expand Up @@ -146,10 +148,12 @@ enum Root {

}

static class StructuredLoggingJsonPropertiesRuntimeHints extends BindableRuntimeHintsRegistrar {
static class StructuredLoggingJsonPropertiesRuntimeHints implements RuntimeHintsRegistrar {

StructuredLoggingJsonPropertiesRuntimeHints() {
super(StructuredLoggingJsonProperties.class);
@Override
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
BindableRuntimeHintsRegistrar.forTypes(StructuredLoggingJsonProperties.class)
.registerHints(hints, classLoader);
}

}
Expand Down