Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring integration EnpointSpec在Spring集成Java DSL中失败_Spring Integration_Spring Integration Http - Fatal编程技术网

Spring integration EnpointSpec在Spring集成Java DSL中失败

Spring integration EnpointSpec在Spring集成Java DSL中失败,spring-integration,spring-integration-http,Spring Integration,Spring Integration Http,对于上面的代码,链接:/test起作用,但没有/test失败。 我在chrome上看到“端点停止” 原因可能是什么 我还不知道为什么,但是从规范中删除@Bean(只需使用一个返回规范的简单方法)。另一种方法是在httpInboundAdapter()Bean定义的末尾从该Http.inboundChannelAdapter调用get()。以下是解决此问题的方法: @SpringBootApplication @EnableIntegration public class SpringIntegr

对于上面的代码,链接:/test起作用,但没有/test失败。 我在chrome上看到“端点停止”


原因可能是什么

我还不知道为什么,但是从规范中删除
@Bean
(只需使用一个返回规范的简单方法)。

另一种方法是在
httpInboundAdapter()
Bean定义的末尾从该
Http.inboundChannelAdapter
调用
get()
。以下是解决此问题的方法:
@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();
}
}