Spring integration EnpointSpec在Spring集成Java DSL中失败
对于上面的代码,链接:/test起作用,但没有/test失败。 我在chrome上看到“端点停止”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
原因可能是什么 我还不知道为什么,但是从规范中删除
@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();
}
}