Skip to content

Commit 8447ce4

Browse files
garyrussellartembilan
authored andcommitted
GH-3018: Fix Http NPE when no application context
Resolves #3018
1 parent d2fc020 commit 8447ce4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

spring-integration-http/src/main/java/org/springframework/integration/http/outbound/AbstractHttpRequestExecutingMessageHandler.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import org.reactivestreams.Publisher;
3535

3636
import org.springframework.beans.factory.BeanFactory;
37+
import org.springframework.context.ApplicationContext;
3738
import org.springframework.core.ParameterizedTypeReference;
3839
import org.springframework.expression.EvaluationContext;
3940
import org.springframework.expression.Expression;
@@ -535,7 +536,9 @@ protected Object evaluateTypeFromExpression(Message<?> requestMessage, @Nullable
535536
"evaluation resulted in a " + typeClass + ".");
536537
if (type instanceof String && StringUtils.hasText((String) type)) {
537538
try {
538-
type = ClassUtils.forName((String) type, getApplicationContext().getClassLoader());
539+
ApplicationContext applicationContext = getApplicationContext();
540+
type = ClassUtils.forName((String) type,
541+
applicationContext == null ? null : applicationContext.getClassLoader());
539542
}
540543
catch (ClassNotFoundException e) {
541544
throw new IllegalStateException("Cannot load class for name: " + type, e);

0 commit comments

Comments
 (0)