Ошибка HttpRequestExecutingMessageHandler с использованием Spring Http.outboundGateway dsl

Я вижу следующую ошибку при использовании Http.outboundGateway. Может ли кто-нибудь помочь, где я ошибаюсь

@Bean
public IntegrationFlow syncProcessFlow() {
    return 
            // dsl code to fetch a message from Queue
            ...
            .<Event, EventType>route(event -> event.getType(), mapping -> mapping
                    .channelMapping(EventType.CREATE, "createFlow")
                    .defaultOutputChannel("nullChannel")
                    .resolutionRequired(false))
            .get();
}

@Bean
public IntegrationFlow createFlow() {
    return IntegrationFlows.from("createFlow")
           .handle(Http.outboundGateway("http://google.com")
                    .httpMethod(HttpMethod.GET)
                    .expectedResponseType(String.class))
            .log(LoggingHandler.Level.DEBUG, "response", m -> m.getPayload())
            .log(LoggingHandler.Level.DEBUG, "response", m -> m.getHeaders())
            .get();
}

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.integration.http.outbound.HttpRequestExecutingMessageHandler#0': Post-processing of merged bean definition failed; nested exception is java.la
ng.IllegalStateException: Failed to introspect Class [org.springframework.integration.http.outbound.AbstractHttpRequestExecutingMessageHandler] from ClassLoader [java.net.URLClassLoader@6e708cdf]


Caused by: java.lang.NoClassDefFoundError: Lorg/springframework/expression/spel/support/SimpleEvaluationContext;

person nagendra    schedule 11.04.2018    source источник


Ответы (1)


В

java.lang.NoClassDefFoundError: Lorg/springframework/expression/spel/support/SimpleEvaluationContext;

означает, что вы обновились до последней версии Spring Integration, но по-прежнему придерживаетесь предыдущей версии Spring Framework.

Или вам нужно полагаться на транзитивную зависимость от Spring Integration, или также обновить Spring Framework.

Вся причина такого критического изменения находится здесь: https://spring.io/blog/2018/04/05/multiple-cve-reports-published-for-the-spring-framework

person Artem Bilan    schedule 11.04.2018
comment
Вышеупомянутая ошибка исчезла после перехода с <springframework.integration.version>5.0.4.RELEASE</springframework.integration.version> <spring.boot.version>2.0.0.RELEASE</spring.boot.version> на <springframework.integration.version>5.0.5.RELEASE</springframework.integration.version> <spring.boot.version>2.0.1.RELEASE</spring.boot.version>. - person nagendra; 11.04.2018
comment
Вам не нужно управлять версией Spring Integration, если вы имеете дело с Spring Boot - person Artem Bilan; 11.04.2018
comment
Ладно. Это отвечает на вопрос, почему версия весенней интеграции не упоминается в примере spring.io/guides/gs/integration - person nagendra; 11.04.2018
comment
Теперь я вижу следующую ошибку Bean named 'createFlow' is expected to be of type 'org.springframework.messaging.MessageChannel' but was actually of type 'org.springframework.integration.dsl.StandardIntegrationFlow' , когда меняю IntegrationFlows.from (createFlow) на IntegrationFlows.from (MessageChannels.direct (createFlow)), тогда я вижу Caused by: org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'createFlow': Requested bean is currently in creation: Is there an unresolvable circular reference? - person nagendra; 11.04.2018
comment
Вы не можете использовать одно и то же имя компонента для разных объектов. Вы видите, что объявляете bean-компонент IntegrationFlow как createFlow, но вы пытаетесь использовать то же имя для определения канала - person Artem Bilan; 11.04.2018
comment
Хорошо понял. Работал сейчас, изменив имя bean-компонента - person nagendra; 11.04.2018