Fix package tangles caused by ConfigurationProperties hints
Relocate `ConfigurationPropertiesReflectionHintsProcessor` and refactor it to be a general purpose `BindableRuntimeHintsRegistrar`. Prior to this commit, `ConfigurationPropertiesReflectionHintsProcessor` was used to declare binding hints for classes that were bound, but might be `@ConfigurationProperties`. By moving and renaming the class, it's now better aligned to the way it's used. Support for `@NestedConfigurationProperties` has been implemented by adding a `@Nestable` meta-annotation. This allow us to create the appropriate hints, without the `Binder` needing to be directly aware of the `@NestedConfigurationProperties` annotation. Closes gh-32815
This commit is contained in:
@@ -16,22 +16,19 @@
|
||||
|
||||
package org.springframework.boot.autoconfigure.freemarker;
|
||||
|
||||
import org.springframework.aot.hint.RuntimeHints;
|
||||
import org.springframework.aot.hint.RuntimeHintsRegistrar;
|
||||
import org.springframework.boot.autoconfigure.freemarker.FreeMarkerTemplateAvailabilityProvider.FreeMarkerTemplateAvailabilityProperties;
|
||||
import org.springframework.boot.context.properties.ConfigurationPropertiesReflectionHintsProcessor;
|
||||
import org.springframework.boot.context.properties.bind.BindableRuntimeHintsRegistrar;
|
||||
|
||||
/**
|
||||
* {@link RuntimeHintsRegistrar} for FreeMarker support.
|
||||
*
|
||||
* @author Moritz Halbritter
|
||||
*/
|
||||
class FreeMarkerRuntimeHints implements RuntimeHintsRegistrar {
|
||||
class FreeMarkerRuntimeHints extends BindableRuntimeHintsRegistrar {
|
||||
|
||||
@Override
|
||||
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
|
||||
ConfigurationPropertiesReflectionHintsProcessor
|
||||
.processConfigurationProperties(FreeMarkerTemplateAvailabilityProperties.class, hints.reflection());
|
||||
FreeMarkerRuntimeHints() {
|
||||
super(FreeMarkerTemplateAvailabilityProperties.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
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;
|
||||
@@ -31,7 +29,7 @@ import org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConf
|
||||
import org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration.NotReactiveWebApplicationCondition;
|
||||
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.jsonb.JsonbAutoConfiguration;
|
||||
import org.springframework.boot.context.properties.ConfigurationPropertiesReflectionHintsProcessor;
|
||||
import org.springframework.boot.context.properties.bind.BindableRuntimeHintsRegistrar;
|
||||
import org.springframework.boot.context.properties.bind.Binder;
|
||||
import org.springframework.boot.web.servlet.server.Encoding;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -102,12 +100,10 @@ public class HttpMessageConvertersAutoConfiguration {
|
||||
|
||||
}
|
||||
|
||||
static class HttpMessageConvertersAutoConfigurationRuntimeHints implements RuntimeHintsRegistrar {
|
||||
static class HttpMessageConvertersAutoConfigurationRuntimeHints extends BindableRuntimeHintsRegistrar {
|
||||
|
||||
@Override
|
||||
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
|
||||
ConfigurationPropertiesReflectionHintsProcessor.processConfigurationProperties(Encoding.class,
|
||||
hints.reflection());
|
||||
HttpMessageConvertersAutoConfigurationRuntimeHints() {
|
||||
super(Encoding.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user