Fix MVC runtime hints.

Signed-off-by: Olga Maciaszek-Sharma <olga.maciaszek-sharma@broadcom.com>
This commit is contained in:
Olga Maciaszek-Sharma
2025-05-29 15:31:48 +02:00
parent 5460911e7d
commit 43fe92f9fa

View File

@@ -33,6 +33,7 @@ import org.springframework.beans.factory.aot.BeanFactoryInitializationAotContrib
import org.springframework.beans.factory.aot.BeanFactoryInitializationAotProcessor;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.cloud.gateway.server.mvc.filter.FilterFunctions;
import org.springframework.cloud.gateway.server.mvc.filter.FilterAutoConfiguration;
import org.springframework.cloud.gateway.server.mvc.predicate.PredicateAutoConfiguration;
import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider;
@@ -75,7 +76,8 @@ public class GatewayMvcRuntimeHintsProcessor implements BeanFactoryInitializatio
ReflectionHints hints = generationContext.getRuntimeHints().reflection();
Set<Class<?>> typesToRegister = Stream
.of(getTypesToRegister(GATEWAY_MVC_FILTER_PACKAGE_NAME),
getTypesToRegister(GATEWAY_MVC_PREDICATE_PACKAGE_NAME), PROPERTIES)
getTypesToRegister(GATEWAY_MVC_PREDICATE_PACKAGE_NAME), PROPERTIES,
new HashSet<>(Collections.singletonList(FilterFunctions.class)))
.flatMap(Set::stream)
.collect(Collectors.toSet());
typesToRegister.forEach(clazz -> hints.registerType(TypeReference.of(clazz),