Reduce instance supplier use to appease AOT

* Remove the use of instance suppliers on bean definitions
that are processed during the AOT phase.

* The remaining areas that use instance suppliers do so
at runtime and do not use reflection, but instead
are passed the configured bean to register.

See https://github.com/spring-cloud/spring-cloud-stream/issues/2655

**Cherry-pick to `6.0.x`**
This commit is contained in:
Chris Bono
2023-03-02 18:00:25 -06:00
committed by abilan
parent d9f3821b9b
commit 5c96c0ded0
17 changed files with 82 additions and 110 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2017-2021 the original author or authors.
* Copyright 2017-2023 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.
@@ -36,6 +36,7 @@ import org.springframework.integration.webflux.support.WebFluxContextUtils;
* The WebFlux Integration infrastructure {@code beanFactory} initializer.
*
* @author Artem Bilan
* @author Chris Bono
*
* @since 5.0
*/
@@ -70,15 +71,14 @@ public class WebFluxIntegrationConfigurationInitializer implements IntegrationCo
!registry.containsBeanDefinition(WebFluxContextUtils.HANDLER_MAPPING_BEAN_NAME)) {
BeanDefinitionBuilder requestMappingBuilder =
BeanDefinitionBuilder.genericBeanDefinition(WebFluxIntegrationRequestMappingHandlerMapping.class,
WebFluxIntegrationRequestMappingHandlerMapping::new)
BeanDefinitionBuilder.genericBeanDefinition(WebFluxIntegrationRequestMappingHandlerMapping.class)
.addPropertyValue("order", 0)
.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
registry.registerBeanDefinition(WebFluxContextUtils.HANDLER_MAPPING_BEAN_NAME,
requestMappingBuilder.getBeanDefinition());
BeanDefinitionReaderUtils.registerWithGeneratedName(
new RootBeanDefinition(IntegrationHandlerResultHandler.class, IntegrationHandlerResultHandler::new),
new RootBeanDefinition(IntegrationHandlerResultHandler.class),
registry);
}
}