Ошибка EnpointSpec в Spring Integration Java DSL

@SpringBootApplication
@EnableIntegration
public class SpringIntegrationHttpApplication {

public static void main(String[] args) {
    SpringApplication.run(SpringIntegrationHttpApplication.class, args);
}

@Bean
public HttpRequestHandlerEndpointSpec httpInboundAdapter() {
    return Http
            .inboundChannelAdapter("/failing-test")
            .requestMapping(r -> r.methods(HttpMethod.GET)
                    .params("rObjectId"))
            .payloadExpression("#requestParams.rObjectId[0]")
            ;
}

@Bean
public IntegrationFlow myFlow() {
    return IntegrationFlows.from(Http
                    .inboundChannelAdapter("/test")
                    .requestMapping(r -> r.methods(HttpMethod.GET)
                    .params("rObjectId"))
            .payloadExpression("#requestParams.rObjectId[0]"))
            .transform(p -> p)
            .handle(p -> System.out.println(p))
            .get();
}

@Bean
public IntegrationFlow yourFlow() {
    return IntegrationFlows.from(httpInboundAdapter())
            .transform(p -> p)
            .handle(p -> System.out.println(p))
            .get();
}
}

Для приведенного выше кода ссылка: /test работает, но не /failing-test. Я получаю «Конечная точка остановлена» в хроме.

В чем может быть причина?


person Guru    schedule 22.01.2019    source источник


Ответы (1)


Я пока не знаю почему, но удалите @Bean из спецификации (просто используйте простой метод, который возвращает спецификацию).

person Gary Russell    schedule 22.01.2019
comment
Другой способ — вызвать get() из Http.inboundChannelAdapter в конце определения компонента httpInboundAdapter(). - person Artem Bilan; 23.01.2019
comment
Вот исправление этой проблемы: github.com/spring-projects/spring- интеграция/тянуть/2710 - person Artem Bilan; 23.01.2019