diff --git a/spring-cloud-openfeign-core/src/main/java/org/springframework/cloud/openfeign/FeignClientFactory.java b/spring-cloud-openfeign-core/src/main/java/org/springframework/cloud/openfeign/FeignClientFactory.java index 177d6a73..2ef8ba66 100644 --- a/spring-cloud-openfeign-core/src/main/java/org/springframework/cloud/openfeign/FeignClientFactory.java +++ b/spring-cloud-openfeign-core/src/main/java/org/springframework/cloud/openfeign/FeignClientFactory.java @@ -38,16 +38,14 @@ import org.springframework.lang.Nullable; */ public class FeignClientFactory extends NamedContextFactory { - private Map> applicationContextInitializers; - public FeignClientFactory() { this(new HashMap<>()); } public FeignClientFactory( Map> applicationContextInitializers) { - super(FeignClientsConfiguration.class, "spring.cloud.openfeign", "spring.cloud.openfeign.client.name"); - this.applicationContextInitializers = applicationContextInitializers; + super(FeignClientsConfiguration.class, "spring.cloud.openfeign", "spring.cloud.openfeign.client.name", + applicationContextInitializers); } @Nullable @@ -79,15 +77,4 @@ public class FeignClientFactory extends NamedContextFactory { - GenericApplicationContext childContext = buildContext(contextId); - applicationContextInitializers.get(contextId).initialize(childContext); - addContext(contextId, childContext); - childContext.refresh(); - }); - // Ensure the contexts are only initialized once after Aot processing - applicationContextInitializers = new HashMap<>(); - } - } diff --git a/spring-cloud-openfeign-core/src/main/java/org/springframework/cloud/openfeign/FeignClientFactoryBean.java b/spring-cloud-openfeign-core/src/main/java/org/springframework/cloud/openfeign/FeignClientFactoryBean.java index 1b5792b2..6ef2aec6 100644 --- a/spring-cloud-openfeign-core/src/main/java/org/springframework/cloud/openfeign/FeignClientFactoryBean.java +++ b/spring-cloud-openfeign-core/src/main/java/org/springframework/cloud/openfeign/FeignClientFactoryBean.java @@ -420,7 +420,6 @@ public class FeignClientFactoryBean T getTarget() { FeignClientFactory feignClientFactory = beanFactory != null ? beanFactory.getBean(FeignClientFactory.class) : applicationContext.getBean(FeignClientFactory.class); - feignClientFactory.initializeChildContexts(); Feign.Builder builder = feign(feignClientFactory); if (!StringUtils.hasText(url) && !isUrlAvailableInConfig(contextId)) {