spring-integration - 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 无效。我在 chrome 上收到“端点已停止”。
可能是什么原因?
解决方案
我不确定为什么,但是@Bean
从规范中删除(只需使用返回规范的简单方法)。
推荐阅读
- javascript - 制作速度时间表/提取数组中的数据
- xpath - 如何使用 xpath 从具有相同名称的元素中调用多个值?
- google-cloud-platform - 当 Bigquery 数据是最新的时与用户共享信息
- django - Django 通过短信重置密码
- ios - iOS:在应用程序中获取强制门户内容 html
- mqtt - 如何使用 IP 配置 mosquitto 代理
- reactjs - Django + React中的用户登录
- cypress - 尝试在 cypress 中上传文件时出错
- rust - 由于需求冲突,无法推断出合适的寿命
- python - 遍历 df 的行并检查行中的任何值是否具有“列表”类型