弹簧集成更新后,有线点击中的UnsupportedOperationException

时间:2017-01-27 00:56:48

标签: spring-integration

我正在使用新的弹簧集成版本测试我现有的应用程序。不幸的是,我遇到了意想不到的异常,如下所示:

Caused by: java.lang.UnsupportedOperationException: null
    at org.springframework.integration.dsl.StandardIntegrationFlow.configure(StandardIntegrationFlow.java:64) ~[spring-integration-java-dsl-1.2.1.RELEASE.jar:na]
    at org.springframework.integration.dsl.IntegrationFlowDefinition.wireTap(IntegrationFlowDefinition.java:341) ~[spring-integration-java-dsl-1.2.1.RELEASE.jar:na]
    at org.springframework.integration.dsl.IntegrationFlowDefinition.wireTap(IntegrationFlowDefinition.java:276) ~[spring-integration-java-dsl-1.2.1.RELEASE.jar:na]
    at com.smartplan.maiscontrole.config.ReportGenerationFlowConfig.buildFlow(ReportGenerationFlowConfig.java:49) ~[main/:na]

我的代码,实际上看起来像:

@Override
protected IntegrationFlowDefinition<?> buildFlow() {
    return this.from(this.requestChannel())               
               .wireTap(this.sideEffectFlow())               
               .channel(new NullChannel());
}

@Bean
MessageChannel requestChannel() {
    return MessageChannels.direct();
}

@Bean
IntegrationFlow sideEffectFlow() {
    return f -> f.handle(System.out::println);
}

关于此的任何线索?

1 个答案:

答案 0 :(得分:3)

M-m-m,我认为它真的是@Bean。 尝试从sideEffectFlow删除 CodeScanner.getInstance().scanBarCode(new ScanResult() { public void scanCompleted(String contents, String formatName, byte[] rawBytes) { //barCode.setText("Bar: " + contents); cnt.addComponent(new Label(contents)); cnt.revalidate(); } public void scanCanceled() { System.out.println("cancelled"); } public void scanError(int errorCode, String message) { System.out.println("err " + message); } });

嵌套流不能是bean。或者通过渠道连接它们。