Name RuntimeHintsRegistrar implementations consistently

Closes gh-31695
pull/31699/head
Stephane Nicoll 2 years ago
parent 7954f5e566
commit 67b5f42769

@ -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<String> DEFAULT_LOCATIONS = List.of("META-INF/resources/", "resources/", "static/",
"public/");

@ -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

@ -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 {
/**

@ -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;
}

@ -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) {

@ -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) {

@ -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) {

@ -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
*/

@ -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
*/

@ -60,7 +60,7 @@ import org.springframework.util.ClassUtils;
*
* @author Andy Wilkinson
*/
class LogbackRuntimeHintsRegistrar implements RuntimeHintsRegistrar {
class LogbackRuntimeHints implements RuntimeHintsRegistrar {
private static final Consumer<Builder> DEFAULT_HINT = (hint) -> {
};

@ -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

@ -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<String> 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<String> 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<String> 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<String> 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());
}

@ -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;
}
Loading…
Cancel
Save