From 67b5f427698d09f49e0d3c771aaaeb852d3b68c1 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Tue, 12 Jul 2022 16:51:57 +0200 Subject: [PATCH] Name RuntimeHintsRegistrar implementations consistently Closes gh-31695 --- ...rar.java => WebResourcesRuntimeHints.java} | 2 +- .../reactive/WebFluxAutoConfiguration.java | 4 ++-- .../web/servlet/WebMvcAutoConfiguration.java | 4 ++-- ...ava => WebResourcesRuntimeHintsTests.java} | 6 +++--- .../boot/WebApplicationType.java | 2 +- ...va => ConfigDataLocationRuntimeHints.java} | 4 ++-- ...r.java => PropertySourceRuntimeHints.java} | 2 +- .../boot/json/JacksonRuntimeHints.java | 2 +- .../java/JavaLoggingSystemRuntimeHints.java | 2 +- ...egistrar.java => LogbackRuntimeHints.java} | 2 +- .../resources/META-INF/spring/aot.factories | 8 ++++---- ... ConfigDataLocationRuntimeHintsTests.java} | 20 +++++++++---------- ...sts.java => LogbackRuntimeHintsTests.java} | 8 ++++---- 13 files changed, 33 insertions(+), 33 deletions(-) rename spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/{WebResourcesRuntimeHintsRegistrar.java => WebResourcesRuntimeHints.java} (94%) rename spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/{WebResourcesRuntimeHintsRegistrarTests.java => WebResourcesRuntimeHintsTests.java} (93%) rename spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/{ConfigDataLocationRuntimeHintsRegistrar.java => ConfigDataLocationRuntimeHints.java} (97%) rename spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/{PropertySourceRuntimeHintsRegistrar.java => PropertySourceRuntimeHints.java} (93%) rename spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/{LogbackRuntimeHintsRegistrar.java => LogbackRuntimeHints.java} (98%) rename spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/{ConfigDataLocationRuntimeHintsRegistrarTests.java => ConfigDataLocationRuntimeHintsTests.java} (86%) rename spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/{LogbackRuntimeHintsRegistrarTests.java => LogbackRuntimeHintsTests.java} (93%) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebResourcesRuntimeHintsRegistrar.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebResourcesRuntimeHints.java similarity index 94% rename from spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebResourcesRuntimeHintsRegistrar.java rename to spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebResourcesRuntimeHints.java index d4a1aa8ec6..ad3b5d7b11 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebResourcesRuntimeHintsRegistrar.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebResourcesRuntimeHints.java @@ -27,7 +27,7 @@ import org.springframework.aot.hint.RuntimeHintsRegistrar; * @author Stephane Nicoll * @since 3.0.0 */ -public class WebResourcesRuntimeHintsRegistrar implements RuntimeHintsRegistrar { +public class WebResourcesRuntimeHints implements RuntimeHintsRegistrar { private static final List DEFAULT_LOCATIONS = List.of("META-INF/resources/", "resources/", "static/", "public/"); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/WebFluxAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/WebFluxAutoConfiguration.java index e3574e4a75..7611d5fe14 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/WebFluxAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/WebFluxAutoConfiguration.java @@ -39,7 +39,7 @@ import org.springframework.boot.autoconfigure.web.ConditionalOnEnabledResourceCh import org.springframework.boot.autoconfigure.web.ServerProperties; import org.springframework.boot.autoconfigure.web.WebProperties; import org.springframework.boot.autoconfigure.web.WebProperties.Resources; -import org.springframework.boot.autoconfigure.web.WebResourcesRuntimeHintsRegistrar; +import org.springframework.boot.autoconfigure.web.WebResourcesRuntimeHints; import org.springframework.boot.autoconfigure.web.format.DateTimeFormatters; import org.springframework.boot.autoconfigure.web.format.WebConversionService; import org.springframework.boot.autoconfigure.web.reactive.WebFluxProperties.Format; @@ -106,7 +106,7 @@ import org.springframework.web.server.session.WebSessionManager; @ConditionalOnClass(WebFluxConfigurer.class) @ConditionalOnMissingBean({ WebFluxConfigurationSupport.class }) @AutoConfigureOrder(Ordered.HIGHEST_PRECEDENCE + 10) -@ImportRuntimeHints(WebResourcesRuntimeHintsRegistrar.class) +@ImportRuntimeHints(WebResourcesRuntimeHints.class) public class WebFluxAutoConfiguration { @Bean diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration.java index bb7db01e6d..85b953222d 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration.java @@ -50,7 +50,7 @@ import org.springframework.boot.autoconfigure.web.ConditionalOnEnabledResourceCh import org.springframework.boot.autoconfigure.web.WebProperties; import org.springframework.boot.autoconfigure.web.WebProperties.Resources; import org.springframework.boot.autoconfigure.web.WebProperties.Resources.Chain.Strategy; -import org.springframework.boot.autoconfigure.web.WebResourcesRuntimeHintsRegistrar; +import org.springframework.boot.autoconfigure.web.WebResourcesRuntimeHints; import org.springframework.boot.autoconfigure.web.format.DateTimeFormatters; import org.springframework.boot.autoconfigure.web.format.WebConversionService; import org.springframework.boot.autoconfigure.web.servlet.WebMvcProperties.Format; @@ -146,7 +146,7 @@ import org.springframework.web.util.pattern.PathPatternParser; @ConditionalOnClass({ Servlet.class, DispatcherServlet.class, WebMvcConfigurer.class }) @ConditionalOnMissingBean(WebMvcConfigurationSupport.class) @AutoConfigureOrder(Ordered.HIGHEST_PRECEDENCE + 10) -@ImportRuntimeHints(WebResourcesRuntimeHintsRegistrar.class) +@ImportRuntimeHints(WebResourcesRuntimeHints.class) public class WebMvcAutoConfiguration { /** diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebResourcesRuntimeHintsRegistrarTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebResourcesRuntimeHintsTests.java similarity index 93% rename from spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebResourcesRuntimeHintsRegistrarTests.java rename to spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebResourcesRuntimeHintsTests.java index 8efeb56b5f..2f4c760364 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebResourcesRuntimeHintsRegistrarTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebResourcesRuntimeHintsTests.java @@ -30,11 +30,11 @@ import org.springframework.aot.hint.RuntimeHints; import static org.assertj.core.api.Assertions.assertThat; /** - * Tests for {@link WebResourcesRuntimeHintsRegistrar}. + * Tests for {@link WebResourcesRuntimeHints}. * * @author Stephane Nicoll */ -class WebResourcesRuntimeHintsRegistrarTests { +class WebResourcesRuntimeHintsTests { @Test void registerHintsWithAllLocations() { @@ -58,7 +58,7 @@ class WebResourcesRuntimeHintsRegistrarTests { RuntimeHints register(ClassLoader classLoader) { RuntimeHints hints = new RuntimeHints(); - WebResourcesRuntimeHintsRegistrar registrar = new WebResourcesRuntimeHintsRegistrar(); + WebResourcesRuntimeHints registrar = new WebResourcesRuntimeHints(); registrar.registerHints(hints, classLoader); return hints; } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/WebApplicationType.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/WebApplicationType.java index 9a7267b562..5f760509f2 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/WebApplicationType.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/WebApplicationType.java @@ -68,7 +68,7 @@ public enum WebApplicationType { return WebApplicationType.SERVLET; } - static class WebApplicationTypeRuntimeHintsRegistrar implements RuntimeHintsRegistrar { + static class WebApplicationTypeRuntimeHints implements RuntimeHintsRegistrar { @Override public void registerHints(RuntimeHints hints, ClassLoader classLoader) { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataLocationRuntimeHintsRegistrar.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataLocationRuntimeHints.java similarity index 97% rename from spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataLocationRuntimeHintsRegistrar.java rename to spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataLocationRuntimeHints.java index 93c6924289..80fe18d803 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataLocationRuntimeHintsRegistrar.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataLocationRuntimeHints.java @@ -36,9 +36,9 @@ import org.springframework.util.ResourceUtils; * @author Stephane Nicoll * @see FilePatternResourceHintsRegistrar */ -class ConfigDataLocationRuntimeHintsRegistrar implements RuntimeHintsRegistrar { +class ConfigDataLocationRuntimeHints implements RuntimeHintsRegistrar { - private static final Log logger = LogFactory.getLog(ConfigDataLocationRuntimeHintsRegistrar.class); + private static final Log logger = LogFactory.getLog(ConfigDataLocationRuntimeHints.class); @Override public void registerHints(RuntimeHints hints, ClassLoader classLoader) { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/PropertySourceRuntimeHintsRegistrar.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/PropertySourceRuntimeHints.java similarity index 93% rename from spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/PropertySourceRuntimeHintsRegistrar.java rename to spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/PropertySourceRuntimeHints.java index f14aad54f0..59412424d3 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/PropertySourceRuntimeHintsRegistrar.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/PropertySourceRuntimeHints.java @@ -25,7 +25,7 @@ import org.springframework.aot.hint.TypeReference; * * @author Stephane Nicoll */ -class PropertySourceRuntimeHintsRegistrar implements RuntimeHintsRegistrar { +class PropertySourceRuntimeHints implements RuntimeHintsRegistrar { @Override public void registerHints(RuntimeHints hints, ClassLoader classLoader) { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/json/JacksonRuntimeHints.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/json/JacksonRuntimeHints.java index fb3012856d..65eabe30d4 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/json/JacksonRuntimeHints.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/json/JacksonRuntimeHints.java @@ -32,7 +32,7 @@ import org.springframework.aot.hint.RuntimeHintsRegistrar; import org.springframework.util.ClassUtils; /** - * {@link RuntimeHintsRegistrar} for Jackson. + * {@link RuntimeHintsRegistrar} implementation for Jackson. * * @author Moritz Halbritter */ diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/java/JavaLoggingSystemRuntimeHints.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/java/JavaLoggingSystemRuntimeHints.java index 252313c014..a68691f0a5 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/java/JavaLoggingSystemRuntimeHints.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/java/JavaLoggingSystemRuntimeHints.java @@ -20,7 +20,7 @@ import org.springframework.aot.hint.RuntimeHints; import org.springframework.aot.hint.RuntimeHintsRegistrar; /** - * Registrar which registers resources needed by {@link JavaLoggingSystem}. + * {@link RuntimeHintsRegistrar} implementation for {@link JavaLoggingSystem}. * * @author Moritz Halbritter */ diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackRuntimeHintsRegistrar.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackRuntimeHints.java similarity index 98% rename from spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackRuntimeHintsRegistrar.java rename to spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackRuntimeHints.java index 8b2df4b20e..c7a3ba8e13 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackRuntimeHintsRegistrar.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackRuntimeHints.java @@ -60,7 +60,7 @@ import org.springframework.util.ClassUtils; * * @author Andy Wilkinson */ -class LogbackRuntimeHintsRegistrar implements RuntimeHintsRegistrar { +class LogbackRuntimeHints implements RuntimeHintsRegistrar { private static final Consumer DEFAULT_HINT = (hint) -> { }; diff --git a/spring-boot-project/spring-boot/src/main/resources/META-INF/spring/aot.factories b/spring-boot-project/spring-boot/src/main/resources/META-INF/spring/aot.factories index 2c2d7468b6..f4f3db0a89 100644 --- a/spring-boot-project/spring-boot/src/main/resources/META-INF/spring/aot.factories +++ b/spring-boot-project/spring-boot/src/main/resources/META-INF/spring/aot.factories @@ -1,10 +1,10 @@ org.springframework.aot.hint.RuntimeHintsRegistrar=\ -org.springframework.boot.context.config.ConfigDataLocationRuntimeHintsRegistrar,\ -org.springframework.boot.env.PropertySourceRuntimeHintsRegistrar,\ +org.springframework.boot.context.config.ConfigDataLocationRuntimeHints,\ +org.springframework.boot.env.PropertySourceRuntimeHints,\ org.springframework.boot.json.JacksonRuntimeHints,\ org.springframework.boot.logging.java.JavaLoggingSystemRuntimeHints,\ -org.springframework.boot.logging.logback.LogbackRuntimeHintsRegistrar,\ -org.springframework.boot.WebApplicationType.WebApplicationTypeRuntimeHintsRegistrar +org.springframework.boot.logging.logback.LogbackRuntimeHints,\ +org.springframework.boot.WebApplicationType.WebApplicationTypeRuntimeHints org.springframework.beans.factory.aot.BeanFactoryInitializationAotProcessor=\ org.springframework.boot.context.properties.ConfigurationPropertiesBeanFactoryInitializationAotProcessor diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataLocationRuntimeHintsRegistrarTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataLocationRuntimeHintsTests.java similarity index 86% rename from spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataLocationRuntimeHintsRegistrarTests.java rename to spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataLocationRuntimeHintsTests.java index 2e1303fc58..be83d09134 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataLocationRuntimeHintsRegistrarTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataLocationRuntimeHintsTests.java @@ -34,16 +34,16 @@ import org.springframework.core.mock.MockSpringFactoriesLoader; import static org.assertj.core.api.Assertions.assertThat; /** - * Tests for {@link ConfigDataLocationRuntimeHintsRegistrar}. + * Tests for {@link ConfigDataLocationRuntimeHints}. * * @author Stephane Nicoll */ -class ConfigDataLocationRuntimeHintsRegistrarTests { +class ConfigDataLocationRuntimeHintsTests { @Test void registerWithDefaultSettings() { RuntimeHints hints = new RuntimeHints(); - new TestConfigDataLocationRuntimeHintsRegistrar().registerHints(hints, null); + new TestConfigDataLocationRuntimeHints().registerHints(hints, null); assertThat(hints.resources().resourcePatterns()).singleElement() .satisfies(includes("application*.properties", "application*.xml", "application*.yaml", "application*.yml", "config/application*.properties", "config/application*.xml", @@ -53,7 +53,7 @@ class ConfigDataLocationRuntimeHintsRegistrarTests { @Test void registerWithCustomName() { RuntimeHints hints = new RuntimeHints(); - new TestConfigDataLocationRuntimeHintsRegistrar() { + new TestConfigDataLocationRuntimeHints() { @Override protected List getFileNames(ClassLoader classLoader) { return List.of("test"); @@ -68,7 +68,7 @@ class ConfigDataLocationRuntimeHintsRegistrarTests { @Test void registerWithCustomLocation() { RuntimeHints hints = new RuntimeHints(); - new TestConfigDataLocationRuntimeHintsRegistrar() { + new TestConfigDataLocationRuntimeHints() { @Override protected List getLocations(ClassLoader classLoader) { return List.of("config/"); @@ -82,7 +82,7 @@ class ConfigDataLocationRuntimeHintsRegistrarTests { @Test void registerWithCustomExtension() { RuntimeHints hints = new RuntimeHints(); - new ConfigDataLocationRuntimeHintsRegistrar() { + new ConfigDataLocationRuntimeHints() { @Override protected List getExtensions(ClassLoader classLoader) { return List.of(".conf"); @@ -95,7 +95,7 @@ class ConfigDataLocationRuntimeHintsRegistrarTests { @Test void registerWithUnknownLocationDoesNotAddHint() { RuntimeHints hints = new RuntimeHints(); - new ConfigDataLocationRuntimeHintsRegistrar() { + new ConfigDataLocationRuntimeHints() { @Override protected List getLocations(ClassLoader classLoader) { return List.of(UUID.randomUUID().toString()); @@ -112,15 +112,15 @@ class ConfigDataLocationRuntimeHintsRegistrarTests { }; } - static class TestConfigDataLocationRuntimeHintsRegistrar extends ConfigDataLocationRuntimeHintsRegistrar { + static class TestConfigDataLocationRuntimeHints extends ConfigDataLocationRuntimeHints { private final MockSpringFactoriesLoader springFactoriesLoader; - TestConfigDataLocationRuntimeHintsRegistrar(MockSpringFactoriesLoader springFactoriesLoader) { + TestConfigDataLocationRuntimeHints(MockSpringFactoriesLoader springFactoriesLoader) { this.springFactoriesLoader = springFactoriesLoader; } - TestConfigDataLocationRuntimeHintsRegistrar() { + TestConfigDataLocationRuntimeHints() { this(springFactoriesLoader()); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackRuntimeHintsRegistrarTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackRuntimeHintsTests.java similarity index 93% rename from spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackRuntimeHintsRegistrarTests.java rename to spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackRuntimeHintsTests.java index 89dc504a20..ed95307727 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackRuntimeHintsRegistrarTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackRuntimeHintsTests.java @@ -40,11 +40,11 @@ import org.springframework.util.ClassUtils; import static org.assertj.core.api.Assertions.assertThat; /** - * Tests for {@link LogbackRuntimeHintsRegistrar}. + * Tests for {@link LogbackRuntimeHints}. * * @author Andy Wilkinson */ -class LogbackRuntimeHintsRegistrarTests { +class LogbackRuntimeHintsTests { @Test void registersHintsForTypesCheckedByLogbackLoggingSystem() { @@ -70,13 +70,13 @@ class LogbackRuntimeHintsRegistrarTests { @Test void doesNotRegisterHintsWhenLoggerContextIsNotAvailable() { RuntimeHints hints = new RuntimeHints(); - new LogbackRuntimeHintsRegistrar().registerHints(hints, ClassLoader.getPlatformClassLoader()); + new LogbackRuntimeHints().registerHints(hints, ClassLoader.getPlatformClassLoader()); assertThat(hints.reflection().typeHints()).isEmpty(); } private ReflectionHints registerHints() { RuntimeHints hints = new RuntimeHints(); - new LogbackRuntimeHintsRegistrar().registerHints(hints, getClass().getClassLoader()); + new LogbackRuntimeHints().registerHints(hints, getClass().getClassLoader()); ReflectionHints reflection = hints.reflection(); return reflection; }