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 2016-2021 the original author or authors.
* Copyright 2016-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.
@@ -31,6 +31,7 @@ import org.springframework.integration.scripting.config.ScriptExecutingProcessor
* The Groovy Module Integration infrastructure {@code beanFactory} initializer.
*
* @author Artem Bilan
* @author Chris Bono
*
* @since 5.0
*/
@@ -52,8 +53,7 @@ public class GroovyIntegrationConfigurationInitializer implements IntegrationCon
protected void registerScriptExecutorProviderIfNecessary(BeanDefinitionRegistry registry) {
if (!registry.containsBeanDefinition(ScriptExecutingProcessorFactory.BEAN_NAME)) {
registry.registerBeanDefinition(ScriptExecutingProcessorFactory.BEAN_NAME,
new RootBeanDefinition(GroovyAwareScriptExecutingProcessorFactory.class,
GroovyAwareScriptExecutingProcessorFactory::new));
new RootBeanDefinition(GroovyAwareScriptExecutingProcessorFactory.class));
}
}