diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/IntegrationEvaluationContextFactoryBean.java b/spring-integration-core/src/main/java/org/springframework/integration/config/IntegrationEvaluationContextFactoryBean.java index 8101a522c5..c9c7b8258c 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/IntegrationEvaluationContextFactoryBean.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/IntegrationEvaluationContextFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2024 the original author or authors. + * Copyright 2013-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. @@ -20,6 +20,7 @@ import java.lang.reflect.Method; import java.util.Map.Entry; import org.springframework.beans.factory.FactoryBean; +import org.springframework.context.ApplicationContext; import org.springframework.context.expression.BeanFactoryResolver; import org.springframework.context.expression.MapAccessor; import org.springframework.expression.BeanResolver; @@ -27,7 +28,9 @@ import org.springframework.expression.IndexAccessor; import org.springframework.expression.PropertyAccessor; import org.springframework.expression.TypeLocator; import org.springframework.expression.spel.support.StandardEvaluationContext; +import org.springframework.expression.spel.support.StandardTypeLocator; import org.springframework.integration.context.IntegrationContextUtils; +import org.springframework.lang.Nullable; /** *

@@ -66,7 +69,8 @@ import org.springframework.integration.context.IntegrationContextUtils; public class IntegrationEvaluationContextFactoryBean extends AbstractEvaluationContextFactoryBean implements FactoryBean { - private volatile TypeLocator typeLocator; + @Nullable + private TypeLocator typeLocator; private BeanResolver beanResolver; @@ -81,8 +85,12 @@ public class IntegrationEvaluationContextFactoryBean extends AbstractEvaluationC @Override public void afterPropertiesSet() { - if (getApplicationContext() != null) { - this.beanResolver = new BeanFactoryResolver(getApplicationContext()); + ApplicationContext applicationContext = getApplicationContext(); + if (applicationContext != null) { + this.beanResolver = new BeanFactoryResolver(applicationContext); + if (this.typeLocator == null) { + this.typeLocator = new StandardTypeLocator(applicationContext.getClassLoader()); + } } initialize(IntegrationContextUtils.INTEGRATION_EVALUATION_CONTEXT_BEAN_NAME); }