From a0944b00d02b11968da863e67e31b66011414288 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Nicoll?= Date: Wed, 7 May 2025 13:10:42 -0700 Subject: [PATCH] Migrate to updated native hints API and new reachability JSON Replace hint API calls with updated version and fix tests that relied on previous JSON files. See gh-45487 Co-authored-by: Phillip Webb --- ...dryWebFluxEndpointHandlerMappingTests.java | 2 +- ...WebEndpointServletHandlerMappingTests.java | 2 +- .../ServiceLevelObjectiveBoundaryTests.java | 4 ++-- .../OperationReflectiveProcessorTests.java | 10 ++++---- .../WebFluxEndpointHandlerMappingTests.java | 2 +- .../WebMvcEndpointHandlerMappingTests.java | 2 +- ...EndpointWebExtensionRuntimeHintsTests.java | 5 ++-- .../info/BuildInfoContributorTests.java | 5 ++-- .../actuate/info/GitInfoContributorTests.java | 5 ++-- .../info/JavaInfoContributorTests.java | 5 ++-- .../actuate/info/OsInfoContributorTests.java | 5 ++-- .../info/ProcessInfoContributorTests.java | 3 +-- .../actuate/info/SslInfoContributorTests.java | 5 ++-- .../actuate/logging/LoggersEndpointTests.java | 11 +++++---- ...azelcastCacheMeterBinderProviderTests.java | 2 +- .../QuartzEndpointWebExtensionTests.java | 5 ++-- .../ScheduledTasksEndpointTests.java | 5 ++-- ...ndlersMappingDescriptionProviderTests.java | 5 ++-- ...rvletsMappingDescriptionProviderTests.java | 5 ++-- ...iltersMappingDescriptionProviderTests.java | 5 ++-- ...rvletsMappingDescriptionProviderTests.java | 5 ++-- .../graphql/GraphQlAutoConfiguration.java | 2 +- .../liquibase/LiquibaseAutoConfiguration.java | 2 +- .../template/TemplateRuntimeHints.java | 4 ++-- ...ssageConvertersAutoConfigurationTests.java | 11 +++++---- .../JacksonAutoConfigurationTests.java | 12 +--------- .../jms/JmsAutoConfigurationTests.java | 2 +- .../web/WebResourcesRuntimeHintsTests.java | 5 +--- .../context/SpringBootContextLoaderTests.java | 2 +- .../springframework/boot/maven/AotTests.java | 18 ++++---------- .../boot/jackson/JsonComponentModule.java | 2 +- .../logback/SpringBootJoranConfigurator.java | 4 ++-- .../boot/ApplicationPropertiesTests.java | 8 +++---- .../ConfigDataLocationRuntimeHintsTests.java | 6 ++--- ...ConfigDataPropertiesRuntimeHintsTests.java | 2 +- ...ntHttpRequestFactoryRuntimeHintsTests.java | 24 ++++++++++++------- .../jackson/JsonComponentModuleTests.java | 7 +++--- ...riesBeanRegistrationAotProcessorTests.java | 7 ++---- ...backConfigurationAotContributionTests.java | 3 +-- .../ElasticCommonSchemaPropertiesTests.java | 8 +++---- ...aylogExtendedLogFormatPropertiesTests.java | 9 +++---- .../StructuredLoggingJsonPropertiesTests.java | 18 +++++++------- .../UndertowWebServerRuntimeHintsTests.java | 15 +++++++----- 43 files changed, 119 insertions(+), 150 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/CloudFoundryWebFluxEndpointHandlerMappingTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/CloudFoundryWebFluxEndpointHandlerMappingTests.java index 0ab3692ac0..46a072e493 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/CloudFoundryWebFluxEndpointHandlerMappingTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/CloudFoundryWebFluxEndpointHandlerMappingTests.java @@ -38,7 +38,7 @@ class CloudFoundryWebFluxEndpointHandlerMappingTests { RuntimeHints runtimeHints = new RuntimeHints(); new CloudFoundryWebFluxEndpointHandlerMappingRuntimeHints().registerHints(runtimeHints, getClass().getClassLoader()); - assertThat(RuntimeHintsPredicates.reflection().onMethod(CloudFoundryLinksHandler.class, "links").invoke()) + assertThat(RuntimeHintsPredicates.reflection().onMethodInvocation(CloudFoundryLinksHandler.class, "links")) .accepts(runtimeHints); assertThat(RuntimeHintsPredicates.reflection().onType(Link.class)).accepts(runtimeHints); } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryWebEndpointServletHandlerMappingTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryWebEndpointServletHandlerMappingTests.java index 5ac2cda847..916e128ab6 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryWebEndpointServletHandlerMappingTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryWebEndpointServletHandlerMappingTests.java @@ -38,7 +38,7 @@ class CloudFoundryWebEndpointServletHandlerMappingTests { RuntimeHints runtimeHints = new RuntimeHints(); new CloudFoundryWebEndpointServletHandlerMappingRuntimeHints().registerHints(runtimeHints, getClass().getClassLoader()); - assertThat(RuntimeHintsPredicates.reflection().onMethod(CloudFoundryLinksHandler.class, "links").invoke()) + assertThat(RuntimeHintsPredicates.reflection().onMethodInvocation(CloudFoundryLinksHandler.class, "links")) .accepts(runtimeHints); assertThat(RuntimeHintsPredicates.reflection().onType(Link.class)).accepts(runtimeHints); } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/ServiceLevelObjectiveBoundaryTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/ServiceLevelObjectiveBoundaryTests.java index 3d88291b1e..27bc141a22 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/ServiceLevelObjectiveBoundaryTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/ServiceLevelObjectiveBoundaryTests.java @@ -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. @@ -84,7 +84,7 @@ class ServiceLevelObjectiveBoundaryTests { getClass().getClassLoader()); ReflectionUtils.doWithLocalMethods(ServiceLevelObjectiveBoundary.class, (method) -> { if ("valueOf".equals(method.getName())) { - assertThat(RuntimeHintsPredicates.reflection().onMethod(method)).accepts(runtimeHints); + assertThat(RuntimeHintsPredicates.reflection().onMethodInvocation(method)).accepts(runtimeHints); } }); } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/annotation/OperationReflectiveProcessorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/annotation/OperationReflectiveProcessorTests.java index 816a82aab2..25efd19885 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/annotation/OperationReflectiveProcessorTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/annotation/OperationReflectiveProcessorTests.java @@ -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. @@ -47,7 +47,7 @@ class OperationReflectiveProcessorTests { void shouldRegisterMethodAsInvokable() { Method method = ReflectionUtils.findMethod(Methods.class, "string"); runProcessor(method); - assertThat(RuntimeHintsPredicates.reflection().onMethod(method)).accepts(this.runtimeHints); + assertThat(RuntimeHintsPredicates.reflection().onMethodInvocation(method)).accepts(this.runtimeHints); } @Test @@ -82,12 +82,10 @@ class OperationReflectiveProcessorTests { private void assertHintsForDto() { assertThat(RuntimeHintsPredicates.reflection() .onType(Dto.class) - .withMemberCategories(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.DECLARED_FIELDS)) - .accepts(this.runtimeHints); + .withMemberCategories(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS)).accepts(this.runtimeHints); assertThat(RuntimeHintsPredicates.reflection() .onType(NestedDto.class) - .withMemberCategories(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.DECLARED_FIELDS)) - .accepts(this.runtimeHints); + .withMemberCategories(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS)).accepts(this.runtimeHints); } private void runProcessor(Method method) { diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/reactive/WebFluxEndpointHandlerMappingTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/reactive/WebFluxEndpointHandlerMappingTests.java index b7dd807579..68456b1f57 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/reactive/WebFluxEndpointHandlerMappingTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/reactive/WebFluxEndpointHandlerMappingTests.java @@ -37,7 +37,7 @@ class WebFluxEndpointHandlerMappingTests { void shouldRegisterHints() { RuntimeHints runtimeHints = new RuntimeHints(); new WebFluxEndpointHandlerMappingRuntimeHints().registerHints(runtimeHints, getClass().getClassLoader()); - assertThat(RuntimeHintsPredicates.reflection().onMethod(WebFluxLinksHandler.class, "links").invoke()) + assertThat(RuntimeHintsPredicates.reflection().onMethodInvocation(WebFluxLinksHandler.class, "links")) .accepts(runtimeHints); assertThat(RuntimeHintsPredicates.reflection().onType(Link.class)).accepts(runtimeHints); } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/servlet/WebMvcEndpointHandlerMappingTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/servlet/WebMvcEndpointHandlerMappingTests.java index 9a8d9d6135..5c8119095e 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/servlet/WebMvcEndpointHandlerMappingTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/servlet/WebMvcEndpointHandlerMappingTests.java @@ -37,7 +37,7 @@ class WebMvcEndpointHandlerMappingTests { void shouldRegisterHints() { RuntimeHints runtimeHints = new RuntimeHints(); new WebMvcEndpointHandlerMappingRuntimeHints().registerHints(runtimeHints, getClass().getClassLoader()); - assertThat(RuntimeHintsPredicates.reflection().onMethod(WebMvcLinksHandler.class, "links").invoke()) + assertThat(RuntimeHintsPredicates.reflection().onMethodInvocation(WebMvcLinksHandler.class, "links")) .accepts(runtimeHints); assertThat(RuntimeHintsPredicates.reflection().onType(Link.class)).accepts(runtimeHints); } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthEndpointWebExtensionRuntimeHintsTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthEndpointWebExtensionRuntimeHintsTests.java index 020f6b522f..4f3d5a2b7f 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthEndpointWebExtensionRuntimeHintsTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthEndpointWebExtensionRuntimeHintsTests.java @@ -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. @@ -41,8 +41,7 @@ class HealthEndpointWebExtensionRuntimeHintsTests { for (Class bindingType : bindingTypes) { assertThat(RuntimeHintsPredicates.reflection() .onType(bindingType) - .withMemberCategories(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.DECLARED_FIELDS)) - .accepts(runtimeHints); + .withMemberCategories(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS)).accepts(runtimeHints); } } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/info/BuildInfoContributorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/info/BuildInfoContributorTests.java index a05dbada3a..5392173246 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/info/BuildInfoContributorTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/info/BuildInfoContributorTests.java @@ -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. @@ -39,8 +39,7 @@ class BuildInfoContributorTests { new BuildInfoContributorRuntimeHints().registerHints(runtimeHints, getClass().getClassLoader()); assertThat(RuntimeHintsPredicates.reflection() .onType(BuildProperties.class) - .withMemberCategories(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.DECLARED_FIELDS)) - .accepts(runtimeHints); + .withMemberCategories(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS)).accepts(runtimeHints); } } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/info/GitInfoContributorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/info/GitInfoContributorTests.java index 0bf002bdef..9dbe669d94 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/info/GitInfoContributorTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/info/GitInfoContributorTests.java @@ -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. @@ -90,8 +90,7 @@ class GitInfoContributorTests { new GitInfoContributorRuntimeHints().registerHints(runtimeHints, getClass().getClassLoader()); assertThat(RuntimeHintsPredicates.reflection() .onType(GitProperties.class) - .withMemberCategories(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.DECLARED_FIELDS)) - .accepts(runtimeHints); + .withMemberCategories(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS)).accepts(runtimeHints); } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/info/JavaInfoContributorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/info/JavaInfoContributorTests.java index 154d37f209..d9443dc23f 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/info/JavaInfoContributorTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/info/JavaInfoContributorTests.java @@ -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. @@ -49,8 +49,7 @@ class JavaInfoContributorTests { new JavaInfoContributorRuntimeHints().registerHints(runtimeHints, getClass().getClassLoader()); assertThat(RuntimeHintsPredicates.reflection() .onType(JavaInfo.class) - .withMemberCategories(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.DECLARED_FIELDS)) - .accepts(runtimeHints); + .withMemberCategories(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS)).accepts(runtimeHints); } } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/info/OsInfoContributorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/info/OsInfoContributorTests.java index d7f292e8f3..f216e3cf40 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/info/OsInfoContributorTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/info/OsInfoContributorTests.java @@ -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. @@ -49,8 +49,7 @@ class OsInfoContributorTests { new OsInfoContributorRuntimeHints().registerHints(runtimeHints, getClass().getClassLoader()); assertThat(RuntimeHintsPredicates.reflection() .onType(OsInfo.class) - .withMemberCategories(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.DECLARED_FIELDS)) - .accepts(runtimeHints); + .withMemberCategories(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS)).accepts(runtimeHints); } } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/info/ProcessInfoContributorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/info/ProcessInfoContributorTests.java index e437802566..5d0f38bb18 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/info/ProcessInfoContributorTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/info/ProcessInfoContributorTests.java @@ -52,8 +52,7 @@ class ProcessInfoContributorTests { new ProcessInfoContributorRuntimeHints().registerHints(runtimeHints, getClass().getClassLoader()); assertThat(RuntimeHintsPredicates.reflection() .onType(ProcessInfo.class) - .withMemberCategories(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.DECLARED_FIELDS)) - .accepts(runtimeHints); + .withMemberCategories(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS)).accepts(runtimeHints); } @Test diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/info/SslInfoContributorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/info/SslInfoContributorTests.java index adfff88f00..9c4cef84b5 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/info/SslInfoContributorTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/info/SslInfoContributorTests.java @@ -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. @@ -56,8 +56,7 @@ class SslInfoContributorTests { new SslInfoContributorRuntimeHints().registerHints(runtimeHints, getClass().getClassLoader()); assertThat(RuntimeHintsPredicates.reflection() .onType(SslInfo.class) - .withMemberCategories(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.DECLARED_FIELDS)) - .accepts(runtimeHints); + .withMemberCategories(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS)).accepts(runtimeHints); } } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/logging/LoggersEndpointTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/logging/LoggersEndpointTests.java index 1bd09a381b..723d4bc109 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/logging/LoggersEndpointTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/logging/LoggersEndpointTests.java @@ -164,16 +164,17 @@ class LoggersEndpointTests { new ReflectiveRuntimeHintsRegistrar().registerRuntimeHints(runtimeHints, LoggersEndpoint.class); ReflectionHintsPredicates reflection = RuntimeHintsPredicates.reflection(); assertThat(reflection.onType(LoggerLevelsDescriptor.class)).accepts(runtimeHints); - assertThat(reflection.onMethod(LoggerLevelsDescriptor.class, "getConfiguredLevel").invoke()) + assertThat(reflection.onMethodInvocation(LoggerLevelsDescriptor.class, "getConfiguredLevel")) .accepts(runtimeHints); assertThat(reflection.onType(SingleLoggerLevelsDescriptor.class)).accepts(runtimeHints); - assertThat(reflection.onMethod(SingleLoggerLevelsDescriptor.class, "getEffectiveLevel").invoke()) + assertThat(reflection.onMethodInvocation(SingleLoggerLevelsDescriptor.class, "getEffectiveLevel")) .accepts(runtimeHints); - assertThat(reflection.onMethod(SingleLoggerLevelsDescriptor.class, "getConfiguredLevel").invoke()) + assertThat(reflection.onMethodInvocation(SingleLoggerLevelsDescriptor.class, "getConfiguredLevel")) .accepts(runtimeHints); assertThat(reflection.onType(GroupLoggerLevelsDescriptor.class)).accepts(runtimeHints); - assertThat(reflection.onMethod(GroupLoggerLevelsDescriptor.class, "getMembers").invoke()).accepts(runtimeHints); - assertThat(reflection.onMethod(GroupLoggerLevelsDescriptor.class, "getConfiguredLevel").invoke()) + assertThat(reflection.onMethodInvocation(GroupLoggerLevelsDescriptor.class, "getMembers")) + .accepts(runtimeHints); + assertThat(reflection.onMethodInvocation(GroupLoggerLevelsDescriptor.class, "getConfiguredLevel")) .accepts(runtimeHints); } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/HazelcastCacheMeterBinderProviderTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/HazelcastCacheMeterBinderProviderTests.java index d3699fcc69..6fe5e6fb20 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/HazelcastCacheMeterBinderProviderTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/HazelcastCacheMeterBinderProviderTests.java @@ -55,7 +55,7 @@ class HazelcastCacheMeterBinderProviderTests { void shouldRegisterHints() { RuntimeHints runtimeHints = new RuntimeHints(); new HazelcastCacheMeterBinderProviderRuntimeHints().registerHints(runtimeHints, getClass().getClassLoader()); - assertThat(RuntimeHintsPredicates.reflection().onMethod(HazelcastCache.class, "getNativeCache").invoke()) + assertThat(RuntimeHintsPredicates.reflection().onMethodInvocation(HazelcastCache.class, "getNativeCache")) .accepts(runtimeHints); assertThat(RuntimeHintsPredicates.reflection().onType(HazelcastCacheMetrics.class)).accepts(runtimeHints); } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/quartz/QuartzEndpointWebExtensionTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/quartz/QuartzEndpointWebExtensionTests.java index 2495f5ed0b..3c3e0d6cb8 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/quartz/QuartzEndpointWebExtensionTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/quartz/QuartzEndpointWebExtensionTests.java @@ -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. @@ -105,8 +105,7 @@ class QuartzEndpointWebExtensionTests { for (Class bindingType : bindingTypes) { assertThat(RuntimeHintsPredicates.reflection() .onType(bindingType) - .withMemberCategories(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.DECLARED_FIELDS)) - .accepts(runtimeHints); + .withMemberCategories(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS)).accepts(runtimeHints); } } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/scheduling/ScheduledTasksEndpointTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/scheduling/ScheduledTasksEndpointTests.java index 7bab283918..83a26bc956 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/scheduling/ScheduledTasksEndpointTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/scheduling/ScheduledTasksEndpointTests.java @@ -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. @@ -206,8 +206,7 @@ class ScheduledTasksEndpointTests { for (Class bindingType : bindingTypes) { assertThat(RuntimeHintsPredicates.reflection() .onType(bindingType) - .withMemberCategories(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.DECLARED_FIELDS)) - .accepts(runtimeHints); + .withMemberCategories(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS)).accepts(runtimeHints); } } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/mappings/reactive/DispatcherHandlersMappingDescriptionProviderTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/mappings/reactive/DispatcherHandlersMappingDescriptionProviderTests.java index 457d76992b..20c39ab758 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/mappings/reactive/DispatcherHandlersMappingDescriptionProviderTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/mappings/reactive/DispatcherHandlersMappingDescriptionProviderTests.java @@ -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. @@ -39,8 +39,7 @@ class DispatcherHandlersMappingDescriptionProviderTests { getClass().getClassLoader()); assertThat(RuntimeHintsPredicates.reflection() .onType(DispatcherHandlerMappingDescription.class) - .withMemberCategories(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.DECLARED_FIELDS)) - .accepts(runtimeHints); + .withMemberCategories(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS)).accepts(runtimeHints); } } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/mappings/servlet/DispatcherServletsMappingDescriptionProviderTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/mappings/servlet/DispatcherServletsMappingDescriptionProviderTests.java index 37e6f5e461..78e08ef93c 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/mappings/servlet/DispatcherServletsMappingDescriptionProviderTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/mappings/servlet/DispatcherServletsMappingDescriptionProviderTests.java @@ -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. @@ -39,8 +39,7 @@ class DispatcherServletsMappingDescriptionProviderTests { getClass().getClassLoader()); assertThat(RuntimeHintsPredicates.reflection() .onType(DispatcherServletMappingDescription.class) - .withMemberCategories(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.DECLARED_FIELDS)) - .accepts(runtimeHints); + .withMemberCategories(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS)).accepts(runtimeHints); } } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/mappings/servlet/FiltersMappingDescriptionProviderTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/mappings/servlet/FiltersMappingDescriptionProviderTests.java index 0cd58884ad..02e392f39b 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/mappings/servlet/FiltersMappingDescriptionProviderTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/mappings/servlet/FiltersMappingDescriptionProviderTests.java @@ -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. @@ -38,8 +38,7 @@ class FiltersMappingDescriptionProviderTests { new FiltersMappingDescriptionProviderRuntimeHints().registerHints(runtimeHints, getClass().getClassLoader()); assertThat(RuntimeHintsPredicates.reflection() .onType(FilterRegistrationMappingDescription.class) - .withMemberCategories(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.DECLARED_FIELDS)) - .accepts(runtimeHints); + .withMemberCategories(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS)).accepts(runtimeHints); } } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/mappings/servlet/ServletsMappingDescriptionProviderTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/mappings/servlet/ServletsMappingDescriptionProviderTests.java index 71dd8984b4..36dc9139d8 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/mappings/servlet/ServletsMappingDescriptionProviderTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/mappings/servlet/ServletsMappingDescriptionProviderTests.java @@ -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. @@ -38,8 +38,7 @@ class ServletsMappingDescriptionProviderTests { new ServletsMappingDescriptionProviderRuntimeHints().registerHints(runtimeHints, getClass().getClassLoader()); assertThat(RuntimeHintsPredicates.reflection() .onType(ServletRegistrationMappingDescription.class) - .withMemberCategories(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.DECLARED_FIELDS)) - .accepts(runtimeHints); + .withMemberCategories(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS)).accepts(runtimeHints); } } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/graphql/GraphQlAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/graphql/GraphQlAutoConfiguration.java index 2f997c8fb5..9a337e3d24 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/graphql/GraphQlAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/graphql/GraphQlAutoConfiguration.java @@ -205,7 +205,7 @@ public class GraphQlAutoConfiguration { @Override public void registerHints(RuntimeHints hints, ClassLoader classLoader) { - hints.resources().registerPattern("graphql/*.graphqls").registerPattern("graphql/*.gqls"); + hints.resources().registerPattern("graphql/**/*.graphqls").registerPattern("graphql/**/*.gqls"); } } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java index 4367e65e23..baabb9ebe1 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java @@ -227,7 +227,7 @@ public class LiquibaseAutoConfiguration { @Override public void registerHints(RuntimeHints hints, ClassLoader classLoader) { - hints.resources().registerPattern("db/changelog/*"); + hints.resources().registerPattern("db/changelog/**"); } } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/TemplateRuntimeHints.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/TemplateRuntimeHints.java index 9184b7b213..8a0264a3e3 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/TemplateRuntimeHints.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/TemplateRuntimeHints.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2022 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. @@ -28,7 +28,7 @@ class TemplateRuntimeHints implements RuntimeHintsRegistrar { @Override public void registerHints(RuntimeHints hints, ClassLoader classLoader) { - hints.resources().registerPatternIfPresent(classLoader, "templates", (hint) -> hint.includes("templates/*")); + hints.resources().registerPatternIfPresent(classLoader, "templates", (hint) -> hint.includes("templates/**")); } } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/http/HttpMessageConvertersAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/http/HttpMessageConvertersAutoConfigurationTests.java index 85bbd33f4f..c537a0e0b3 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/http/HttpMessageConvertersAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/http/HttpMessageConvertersAutoConfigurationTests.java @@ -335,11 +335,12 @@ class HttpMessageConvertersAutoConfigurationTests { RuntimeHints hints = new RuntimeHints(); new HttpMessageConvertersAutoConfigurationRuntimeHints().registerHints(hints, getClass().getClassLoader()); assertThat(RuntimeHintsPredicates.reflection().onType(Encoding.class)).accepts(hints); - assertThat(RuntimeHintsPredicates.reflection().onMethod(Encoding.class, "getCharset").invoke()).accepts(hints); - assertThat(RuntimeHintsPredicates.reflection().onMethod(Encoding.class, "setCharset").invoke()).accepts(hints); - assertThat(RuntimeHintsPredicates.reflection().onMethod(Encoding.class, "isForce").invoke()).accepts(hints); - assertThat(RuntimeHintsPredicates.reflection().onMethod(Encoding.class, "setForce").invoke()).accepts(hints); - assertThat(RuntimeHintsPredicates.reflection().onMethod(Encoding.class, "shouldForce")).rejects(hints); + assertThat(RuntimeHintsPredicates.reflection().onMethodInvocation(Encoding.class, "getCharset")).accepts(hints); + assertThat(RuntimeHintsPredicates.reflection().onMethodInvocation(Encoding.class, "setCharset")).accepts(hints); + assertThat(RuntimeHintsPredicates.reflection().onMethodInvocation(Encoding.class, "isForce")).accepts(hints); + assertThat(RuntimeHintsPredicates.reflection().onMethodInvocation(Encoding.class, "setForce")).accepts(hints); + assertThat(RuntimeHintsPredicates.reflection().onMethodInvocation(Encoding.class, "shouldForce")) + .rejects(hints); } private ApplicationContextRunner allOptionsRunner() { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfigurationTests.java index 52f5965a81..c26563843e 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfigurationTests.java @@ -23,7 +23,6 @@ import java.time.Duration; import java.util.Date; import java.util.HashSet; import java.util.Set; -import java.util.stream.Stream; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonCreator.Mode; @@ -56,7 +55,6 @@ import org.assertj.core.api.InstanceOfAssertFactories; import org.junit.jupiter.api.Test; import org.springframework.aot.hint.RuntimeHints; -import org.springframework.aot.hint.predicate.ReflectionHintsPredicates; import org.springframework.aot.hint.predicate.RuntimeHintsPredicates; import org.springframework.beans.factory.BeanCurrentlyInCreationException; import org.springframework.boot.autoconfigure.AutoConfigurationPackage; @@ -501,17 +499,9 @@ class JacksonAutoConfigurationTests { @Test void shouldRegisterPropertyNamingStrategyHints() { - shouldRegisterPropertyNamingStrategyHints(PropertyNamingStrategies.class, "LOWER_CAMEL_CASE", - "UPPER_CAMEL_CASE", "SNAKE_CASE", "UPPER_SNAKE_CASE", "LOWER_CASE", "KEBAB_CASE", "LOWER_DOT_CASE"); - } - - private void shouldRegisterPropertyNamingStrategyHints(Class type, String... fieldNames) { RuntimeHints hints = new RuntimeHints(); new JacksonAutoConfigurationRuntimeHints().registerHints(hints, getClass().getClassLoader()); - ReflectionHintsPredicates reflection = RuntimeHintsPredicates.reflection(); - Stream.of(fieldNames) - .map((name) -> reflection.onField(type, name)) - .forEach((predicate) -> assertThat(predicate).accepts(hints)); + assertThat(RuntimeHintsPredicates.reflection().onType(PropertyNamingStrategies.class)).accepts(hints); } private void assertParameterNamesModuleCreatorBinding(Mode expectedMode, Class... configClasses) { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/JmsAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/JmsAutoConfigurationTests.java index 365cf5266a..f401349871 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/JmsAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/JmsAutoConfigurationTests.java @@ -416,7 +416,7 @@ class JmsAutoConfigurationTests { context.register(TestConfiguration2.class, JmsAutoConfiguration.class); TestGenerationContext generationContext = new TestGenerationContext(); new ApplicationContextAotGenerator().processAheadOfTime(context, generationContext); - assertThat(RuntimeHintsPredicates.reflection().onMethod(AcknowledgeMode.class, "of").invoke()) + assertThat(RuntimeHintsPredicates.reflection().onMethodInvocation(AcknowledgeMode.class, "of")) .accepts(generationContext.getRuntimeHints()); } } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebResourcesRuntimeHintsTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebResourcesRuntimeHintsTests.java index 29cb54d08c..7f77aa5b90 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebResourcesRuntimeHintsTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebResourcesRuntimeHintsTests.java @@ -66,10 +66,7 @@ class WebResourcesRuntimeHintsTests { } private Consumer include(String... patterns) { - return (hint) -> { - assertThat(hint.getIncludes()).map(ResourcePatternHint::getPattern).contains(patterns); - assertThat(hint.getExcludes()).isEmpty(); - }; + return (hint) -> assertThat(hint.getIncludes()).map(ResourcePatternHint::getPattern).contains(patterns); } private static class TestClassLoader extends ClassLoader { diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootContextLoaderTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootContextLoaderTests.java index ddd5e42893..67fd2e5172 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootContextLoaderTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootContextLoaderTests.java @@ -268,7 +268,7 @@ class SpringBootContextLoaderTests { .buildMergedContextConfiguration(); RuntimeHints runtimeHints = new RuntimeHints(); contextLoader.loadContextForAotProcessing(contextConfiguration, runtimeHints); - assertThat(RuntimeHintsPredicates.reflection().onMethod(ConfigWithMain.class, "main").invoke()) + assertThat(RuntimeHintsPredicates.reflection().onMethodInvocation(ConfigWithMain.class, "main")) .accepts(runtimeHints); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/AotTests.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/AotTests.java index d354523eb9..c0ff9dbc5a 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/AotTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/AotTests.java @@ -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. @@ -54,9 +54,7 @@ class AotTests { Path targetClasses = project.toPath().resolve("target/classes"); assertThat(collectRelativePaths(targetClasses)).contains( Path.of("META-INF", "native-image", "org.springframework.boot.maven.it", "aot-resource-generation", - "reflect-config.json"), - Path.of("META-INF", "native-image", "org.springframework.boot.maven.it", "aot-resource-generation", - "resource-config.json"), + "reachability-metadata.json"), Path.of("META-INF", "native-image", "org.springframework.boot.maven.it", "aot-resource-generation", "native-image.properties"), Path.of("generated-resource"), Path.of("nested/generated-resource")); @@ -69,11 +67,7 @@ class AotTests { Path aotDirectory = project.toPath().resolve("target/spring-aot/main"); assertThat(collectRelativePaths(aotDirectory.resolve("resources"))).contains( Path.of("META-INF", "native-image", "org.springframework.boot.maven.it", "aot-jdk-proxy", - "reflect-config.json"), - Path.of("META-INF", "native-image", "org.springframework.boot.maven.it", "aot-jdk-proxy", - "resource-config.json"), - Path.of("META-INF", "native-image", "org.springframework.boot.maven.it", "aot-jdk-proxy", - "proxy-config.json"), + "reachability-metadata.json"), Path.of("META-INF", "native-image", "org.springframework.boot.maven.it", "aot-jdk-proxy", "native-image.properties")); }); @@ -155,9 +149,7 @@ class AotTests { mavenBuild.project("aot-jdk-proxy").goals("package").execute((project) -> { Path classesDirectory = project.toPath().resolve("target/classes/META-INF/native-image"); assertThat(collectRelativePaths(classesDirectory)).contains( - Path.of("org.springframework.boot.maven.it", "aot-jdk-proxy", "reflect-config.json"), - Path.of("org.springframework.boot.maven.it", "aot-jdk-proxy", "resource-config.json"), - Path.of("org.springframework.boot.maven.it", "aot-jdk-proxy", "proxy-config.json"), + Path.of("org.springframework.boot.maven.it", "aot-jdk-proxy", "reachability-metadata.json"), Path.of("org.springframework.boot.maven.it", "aot-jdk-proxy", "native-image.properties")); }); } @@ -179,7 +171,7 @@ class AotTests { "SampleApplicationTests__TestContext001_ApplicationContextInitializer.java")); Path testClassesDirectory = project.toPath().resolve("target/test-classes"); assertThat(collectRelativePaths(testClassesDirectory)).contains(Path.of("META-INF", "native-image", - "org.springframework.boot.maven.it", "aot-test", "reflect-config.json")); + "org.springframework.boot.maven.it", "aot-test", "reachability-metadata.json")); assertThat(collectRelativePaths(testClassesDirectory)).contains(Path.of("org", "test", "SampleApplicationTests__TestContext001_ApplicationContextInitializer.class")); }); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jackson/JsonComponentModule.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jackson/JsonComponentModule.java index 68fdb84dab..c08db410b5 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jackson/JsonComponentModule.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jackson/JsonComponentModule.java @@ -192,7 +192,7 @@ public class JsonComponentModule extends SimpleModule implements BeanFactoryAwar BeanFactoryInitializationCode beanFactoryInitializationCode) { ReflectionHints reflection = generationContext.getRuntimeHints().reflection(); this.innerComponents.forEach((outer, inners) -> { - reflection.registerType(outer, MemberCategory.DECLARED_CLASSES); + reflection.registerType(outer); inners.forEach((inner) -> reflection.registerType(inner, MemberCategory.INVOKE_DECLARED_CONSTRUCTORS)); }); } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/SpringBootJoranConfigurator.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/SpringBootJoranConfigurator.java index 24cd20fa82..b5efebe710 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/SpringBootJoranConfigurator.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/SpringBootJoranConfigurator.java @@ -188,8 +188,8 @@ class SpringBootJoranConfigurator extends JoranConfigurator { serializationTypes(this.model).forEach(serializationHints::registerType); reflectionTypes(this.model).forEach((type) -> generationContext.getRuntimeHints() .reflection() - .registerType(TypeReference.of(type), MemberCategory.INTROSPECT_PUBLIC_METHODS, - MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS)); + .registerType(TypeReference.of(type), MemberCategory.INVOKE_PUBLIC_METHODS, + MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS)); } private byte[] serializeModel() { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ApplicationPropertiesTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ApplicationPropertiesTests.java index cacda7106c..0c484446dd 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ApplicationPropertiesTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ApplicationPropertiesTests.java @@ -52,13 +52,13 @@ class ApplicationPropertiesTests { RuntimeHints hints = new RuntimeHints(); new ApplicationPropertiesRuntimeHints().registerHints(hints, getClass().getClassLoader()); assertThat(RuntimeHintsPredicates.reflection().onType(ApplicationProperties.class)).accepts(hints); - assertThat(RuntimeHintsPredicates.reflection().onMethod(ApplicationProperties.class, "setBannerMode").invoke()) + assertThat(RuntimeHintsPredicates.reflection().onMethodInvocation(ApplicationProperties.class, "setBannerMode")) .accepts(hints); - assertThat(RuntimeHintsPredicates.reflection().onMethod(ApplicationProperties.class, "getSources").invoke()) + assertThat(RuntimeHintsPredicates.reflection().onMethodInvocation(ApplicationProperties.class, "getSources")) .accepts(hints); - assertThat(RuntimeHintsPredicates.reflection().onMethod(ApplicationProperties.class, "setSources").invoke()) + assertThat(RuntimeHintsPredicates.reflection().onMethodInvocation(ApplicationProperties.class, "setSources")) .accepts(hints); - assertThat(RuntimeHintsPredicates.reflection().onMethod(ApplicationProperties.class, "getBannerMode")) + assertThat(RuntimeHintsPredicates.reflection().onMethodInvocation(ApplicationProperties.class, "getBannerMode")) .rejects(hints); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataLocationRuntimeHintsTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataLocationRuntimeHintsTests.java index 7db561f819..e48d1e012a 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataLocationRuntimeHintsTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataLocationRuntimeHintsTests.java @@ -114,10 +114,8 @@ class ConfigDataLocationRuntimeHintsTests { } private Consumer includes(String... patterns) { - return (hint) -> { - assertThat(hint.getIncludes().stream().map(ResourcePatternHint::getPattern)).contains(patterns); - assertThat(hint.getExcludes()).isEmpty(); - }; + return (hint) -> assertThat(hint.getIncludes().stream().map(ResourcePatternHint::getPattern)) + .contains(patterns); } static class TestConfigDataLocationRuntimeHints extends ConfigDataLocationRuntimeHints { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataPropertiesRuntimeHintsTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataPropertiesRuntimeHintsTests.java index 376caeb6eb..0166875d30 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataPropertiesRuntimeHintsTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataPropertiesRuntimeHintsTests.java @@ -38,7 +38,7 @@ class ConfigDataPropertiesRuntimeHintsTests { assertThat(RuntimeHintsPredicates.reflection().onType(ConfigDataProperties.class)).accepts(hints); assertThat(RuntimeHintsPredicates.reflection().onType(ConfigDataLocation.class)).accepts(hints); assertThat(RuntimeHintsPredicates.reflection().onType(Activate.class)).accepts(hints); - assertThat(RuntimeHintsPredicates.reflection().onMethod(ConfigDataLocation.class, "of").invoke()) + assertThat(RuntimeHintsPredicates.reflection().onMethodInvocation(ConfigDataLocation.class, "of")) .accepts(hints); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/http/client/ClientHttpRequestFactoryRuntimeHintsTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/http/client/ClientHttpRequestFactoryRuntimeHintsTests.java index a6918df481..d54f88b814 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/http/client/ClientHttpRequestFactoryRuntimeHintsTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/http/client/ClientHttpRequestFactoryRuntimeHintsTests.java @@ -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. @@ -49,7 +49,7 @@ class ClientHttpRequestFactoryRuntimeHintsTests { Field requestFactoryField = ReflectionUtils.findField(AbstractClientHttpRequestFactoryWrapper.class, "requestFactory"); assertThat(requestFactoryField).isNotNull(); - assertThat(reflection.onField(requestFactoryField)).accepts(hints); + assertThat(reflection.onFieldAccess(requestFactoryField)).accepts(hints); } @Test @@ -58,7 +58,7 @@ class ClientHttpRequestFactoryRuntimeHintsTests { new ClientHttpRequestFactoryRuntimeHints().registerHints(hints, getClass().getClassLoader()); ReflectionHintsPredicates reflection = RuntimeHintsPredicates.reflection(); assertThat(reflection - .onMethod(method(HttpComponentsClientHttpRequestFactory.class, "setConnectTimeout", int.class))) + .onMethodInvocation(method(HttpComponentsClientHttpRequestFactory.class, "setConnectTimeout", int.class))) .accepts(hints); } @@ -67,9 +67,11 @@ class ClientHttpRequestFactoryRuntimeHintsTests { RuntimeHints hints = new RuntimeHints(); new ClientHttpRequestFactoryRuntimeHints().registerHints(hints, getClass().getClassLoader()); ReflectionHintsPredicates reflection = RuntimeHintsPredicates.reflection(); - assertThat(reflection.onMethod(method(JettyClientHttpRequestFactory.class, "setConnectTimeout", int.class))) + assertThat(reflection + .onMethodInvocation(method(JettyClientHttpRequestFactory.class, "setConnectTimeout", int.class))) .accepts(hints); - assertThat(reflection.onMethod(method(JettyClientHttpRequestFactory.class, "setReadTimeout", long.class))) + assertThat(reflection + .onMethodInvocation(method(JettyClientHttpRequestFactory.class, "setReadTimeout", long.class))) .accepts(hints); } @@ -78,9 +80,11 @@ class ClientHttpRequestFactoryRuntimeHintsTests { RuntimeHints hints = new RuntimeHints(); new ClientHttpRequestFactoryRuntimeHints().registerHints(hints, getClass().getClassLoader()); ReflectionHintsPredicates reflection = RuntimeHintsPredicates.reflection(); - assertThat(reflection.onMethod(method(ReactorClientHttpRequestFactory.class, "setConnectTimeout", int.class))) + assertThat(reflection + .onMethodInvocation(method(ReactorClientHttpRequestFactory.class, "setConnectTimeout", int.class))) .accepts(hints); - assertThat(reflection.onMethod(method(ReactorClientHttpRequestFactory.class, "setReadTimeout", long.class))) + assertThat(reflection + .onMethodInvocation(method(ReactorClientHttpRequestFactory.class, "setReadTimeout", long.class))) .accepts(hints); } @@ -89,9 +93,11 @@ class ClientHttpRequestFactoryRuntimeHintsTests { RuntimeHints hints = new RuntimeHints(); new ClientHttpRequestFactoryRuntimeHints().registerHints(hints, getClass().getClassLoader()); ReflectionHintsPredicates reflection = RuntimeHintsPredicates.reflection(); - assertThat(reflection.onMethod(method(SimpleClientHttpRequestFactory.class, "setConnectTimeout", int.class))) + assertThat(reflection + .onMethodInvocation(method(SimpleClientHttpRequestFactory.class, "setConnectTimeout", int.class))) .accepts(hints); - assertThat(reflection.onMethod(method(SimpleClientHttpRequestFactory.class, "setReadTimeout", int.class))) + assertThat(reflection + .onMethodInvocation(method(SimpleClientHttpRequestFactory.class, "setReadTimeout", int.class))) .accepts(hints); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jackson/JsonComponentModuleTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jackson/JsonComponentModuleTests.java index f6ae8a6974..07e715afb0 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jackson/JsonComponentModuleTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jackson/JsonComponentModuleTests.java @@ -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. @@ -134,9 +134,8 @@ class JsonComponentModuleTests { TestGenerationContext generationContext = new TestGenerationContext(); contribution.applyTo(generationContext, null); RuntimeHints runtimeHints = generationContext.getRuntimeHints(); - assertThat(RuntimeHintsPredicates.reflection() - .onType(ComponentWithInnerAbstractClass.class) - .withMemberCategory(MemberCategory.DECLARED_CLASSES)).accepts(runtimeHints); + assertThat(RuntimeHintsPredicates.reflection().onType(ComponentWithInnerAbstractClass.class)) + .accepts(runtimeHints); assertThat(RuntimeHintsPredicates.reflection() .onType(ConcreteSerializer.class) .withMemberCategory(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS)).accepts(runtimeHints); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jackson/JsonMixinModuleEntriesBeanRegistrationAotProcessorTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jackson/JsonMixinModuleEntriesBeanRegistrationAotProcessorTests.java index b2e19ea7b5..5f5493d3f3 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jackson/JsonMixinModuleEntriesBeanRegistrationAotProcessorTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jackson/JsonMixinModuleEntriesBeanRegistrationAotProcessorTests.java @@ -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. @@ -67,10 +67,7 @@ class JsonMixinModuleEntriesBeanRegistrationAotProcessorTests { RuntimeHints runtimeHints = this.generationContext.getRuntimeHints(); assertThat(RuntimeHintsPredicates.reflection() .onType(RenameMixInClass.class) - .withMemberCategories(MemberCategory.DECLARED_FIELDS, MemberCategory.INVOKE_DECLARED_CONSTRUCTORS)) - .accepts(runtimeHints); - assertThat(RuntimeHintsPredicates.reflection().onMethod(RenameMixInClass.class, "getName").introspect()) - .accepts(runtimeHints); + .withMemberCategories(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS)).accepts(runtimeHints); } @Test diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackConfigurationAotContributionTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackConfigurationAotContributionTests.java index 6cd9d6f29b..e495d557fd 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackConfigurationAotContributionTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackConfigurationAotContributionTests.java @@ -267,8 +267,7 @@ class LogbackConfigurationAotContributionTests { private Predicate invokePublicConstructorsAndInspectAndInvokePublicMethodsOf(Class type) { return RuntimeHintsPredicates.reflection() .onType(TypeReference.of(type)) - .withMemberCategories(MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS, MemberCategory.INTROSPECT_PUBLIC_METHODS, - MemberCategory.INVOKE_PUBLIC_METHODS); + .withMemberCategories(MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS, MemberCategory.INVOKE_PUBLIC_METHODS); } private Consumer hasValidTypeName(Class type) { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/structured/ElasticCommonSchemaPropertiesTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/structured/ElasticCommonSchemaPropertiesTests.java index a804fde4f3..71a13ea4ee 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/structured/ElasticCommonSchemaPropertiesTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/structured/ElasticCommonSchemaPropertiesTests.java @@ -96,12 +96,12 @@ class ElasticCommonSchemaPropertiesTests { new ElasticCommonSchemaPropertiesRuntimeHints().registerHints(hints, getClass().getClassLoader()); assertThat(RuntimeHintsPredicates.reflection().onType(ElasticCommonSchemaProperties.class)).accepts(hints); assertThat(RuntimeHintsPredicates.reflection() - .onConstructor(ElasticCommonSchemaProperties.class.getConstructor(Service.class)) - .invoke()).accepts(hints); + .onConstructorInvocation(ElasticCommonSchemaProperties.class.getConstructor(Service.class))).accepts(hints); assertThat(RuntimeHintsPredicates.reflection().onType(Service.class)).accepts(hints); assertThat(RuntimeHintsPredicates.reflection() - .onConstructor(Service.class.getConstructor(String.class, String.class, String.class, String.class)) - .invoke()).accepts(hints); + .onConstructorInvocation( + Service.class.getConstructor(String.class, String.class, String.class, String.class))) + .accepts(hints); } @Test diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/structured/GraylogExtendedLogFormatPropertiesTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/structured/GraylogExtendedLogFormatPropertiesTests.java index 74dae1e163..d3df58d9bf 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/structured/GraylogExtendedLogFormatPropertiesTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/structured/GraylogExtendedLogFormatPropertiesTests.java @@ -109,12 +109,13 @@ class GraylogExtendedLogFormatPropertiesTests { new GraylogExtendedLogFormatPropertiesRuntimeHints().registerHints(hints, getClass().getClassLoader()); assertThat(RuntimeHintsPredicates.reflection().onType(GraylogExtendedLogFormatProperties.class)).accepts(hints); assertThat(RuntimeHintsPredicates.reflection() - .onConstructor(GraylogExtendedLogFormatProperties.class.getConstructor(String.class, Service.class)) - .invoke()).accepts(hints); + .onConstructorInvocation( + GraylogExtendedLogFormatProperties.class.getConstructor(String.class, Service.class))) + .accepts(hints); assertThat(RuntimeHintsPredicates.reflection().onType(Service.class)).accepts(hints); assertThat(RuntimeHintsPredicates.reflection() - .onConstructor(GraylogExtendedLogFormatProperties.Service.class.getConstructor(String.class)) - .invoke()).accepts(hints); + .onConstructorInvocation(GraylogExtendedLogFormatProperties.Service.class.getConstructor(String.class))) + .accepts(hints); } @Test diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/structured/StructuredLoggingJsonPropertiesTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/structured/StructuredLoggingJsonPropertiesTests.java index b68246f8ee..ff62a1b37c 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/structured/StructuredLoggingJsonPropertiesTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/structured/StructuredLoggingJsonPropertiesTests.java @@ -90,17 +90,17 @@ class StructuredLoggingJsonPropertiesTests { RuntimeHints hints = new RuntimeHints(); new StructuredLoggingJsonPropertiesRuntimeHints().registerHints(hints, getClass().getClassLoader()); assertThat(RuntimeHintsPredicates.reflection().onType(StructuredLoggingJsonProperties.class)).accepts(hints); + assertThat( + RuntimeHintsPredicates.reflection() + .onConstructorInvocation(StructuredLoggingJsonProperties.class.getDeclaredConstructor(Set.class, + Set.class, Map.class, Map.class, StackTrace.class, Context.class, Set.class))) + .accepts(hints); assertThat(RuntimeHintsPredicates.reflection() - .onConstructor(StructuredLoggingJsonProperties.class.getDeclaredConstructor(Set.class, Set.class, Map.class, - Map.class, StackTrace.class, Context.class, Set.class)) - .invoke()).accepts(hints); + .onConstructorInvocation(StackTrace.class.getDeclaredConstructor(String.class, Root.class, Integer.class, + Integer.class, Boolean.class, Boolean.class))) + .accepts(hints); assertThat(RuntimeHintsPredicates.reflection() - .onConstructor(StackTrace.class.getDeclaredConstructor(String.class, Root.class, Integer.class, - Integer.class, Boolean.class, Boolean.class)) - .invoke()).accepts(hints); - assertThat(RuntimeHintsPredicates.reflection() - .onConstructor(Context.class.getDeclaredConstructor(boolean.class, String.class)) - .invoke()).accepts(hints); + .onConstructorInvocation(Context.class.getDeclaredConstructor(boolean.class, String.class))).accepts(hints); } @Test diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/undertow/UndertowWebServerRuntimeHintsTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/undertow/UndertowWebServerRuntimeHintsTests.java index 58f84e02fd..fdc73e1459 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/undertow/UndertowWebServerRuntimeHintsTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/undertow/UndertowWebServerRuntimeHintsTests.java @@ -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. @@ -16,11 +16,12 @@ package org.springframework.boot.web.embedded.undertow; +import java.util.function.Predicate; + import io.undertow.Undertow; import org.junit.jupiter.api.Test; import org.springframework.aot.hint.RuntimeHints; -import org.springframework.aot.hint.predicate.ReflectionHintsPredicates.FieldHintPredicate; import org.springframework.aot.hint.predicate.RuntimeHintsPredicates; import org.springframework.boot.web.embedded.undertow.UndertowWebServer.UndertowWebServerRuntimeHints; import org.springframework.util.ReflectionUtils; @@ -38,17 +39,19 @@ class UndertowWebServerRuntimeHintsTests { void registersHints() throws ClassNotFoundException { RuntimeHints runtimeHints = new RuntimeHints(); new UndertowWebServerRuntimeHints().registerHints(runtimeHints, getClass().getClassLoader()); - assertThat(RuntimeHintsPredicates.reflection().onField(Undertow.class, "listeners")).accepts(runtimeHints); - assertThat(RuntimeHintsPredicates.reflection().onField(Undertow.class, "channels")).accepts(runtimeHints); + assertThat(RuntimeHintsPredicates.reflection().onFieldAccess(Undertow.class, "listeners")) + .accepts(runtimeHints); + assertThat(RuntimeHintsPredicates.reflection().onFieldAccess(Undertow.class, "channels")).accepts(runtimeHints); assertThat(reflectionOnField("io.undertow.Undertow$ListenerConfig", "type")).accepts(runtimeHints); assertThat(reflectionOnField("io.undertow.Undertow$ListenerConfig", "port")).accepts(runtimeHints); assertThat(reflectionOnField("io.undertow.protocols.ssl.UndertowAcceptingSslChannel", "ssl")) .accepts(runtimeHints); } - private FieldHintPredicate reflectionOnField(String className, String fieldName) throws ClassNotFoundException { + private Predicate reflectionOnField(String className, String fieldName) + throws ClassNotFoundException { return RuntimeHintsPredicates.reflection() - .onField(ReflectionUtils.findField(Class.forName(className), fieldName)); + .onFieldAccess(ReflectionUtils.findField(Class.forName(className), fieldName)); } }