Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/339.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/13.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与JavaDSL集成中的Bean和方法名与lambda_Java_Spring_Spring Integration_Dsl - Fatal编程技术网

Spring与JavaDSL集成中的Bean和方法名与lambda

Spring与JavaDSL集成中的Bean和方法名与lambda,java,spring,spring-integration,dsl,Java,Spring,Spring Integration,Dsl,Spring Integration Java Dsl中有没有一种方法可以做到这一点: @Bean IntegrationFlow serviceFlow() { return IntegrationFlows .from("inputChannel") .handle(File.class, (p,h) -> someService.someMethod(p)) .channel("someChannel") .ge


Spring Integration Java Dsl中有没有一种方法可以做到这一点:

@Bean
IntegrationFlow serviceFlow() {
    return IntegrationFlows
        .from("inputChannel")
        .handle(File.class, (p,h) -> someService.someMethod(p))
        .channel("someChannel")
        .get();
}
表现如下:

@Bean
IntegrationFlow serviceFlow() {
    return IntegrationFlows
        .from("inputChannel")
        .handle("someService","someMethod")
        .channel("someChannel")
        .get();
}
当涉及到异常处理时

第一个版本抛出:

2015-06-03 23:30:42.912 ERROR 6251 --- [ask-scheduler-1] o.s.integration.handler.LoggingHandler   : org.springframework.messaging.MessageHandlingException: ; nested exception is java.lang.reflect.InvocationTargetException
at org.springframework.integration.dsl.LambdaMessageProcessor.processMessage(LambdaMessageProcessor.java:129)
at org.springframework.integration.handler.ServiceActivatingHandler.handleRequestMessage(ServiceActivatingHandler.java:71)
(...)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
(...)
Caused by: java.lang.RuntimeException: error from service
at com.lukzar.SomeService.someMethod(SomeService.java:15)
at com.lukzar.IntegrationConfiguration.lambda$serviceFlow$1(IntegrationConfiguration.java:48)
at com.lukzar.IntegrationConfiguration$$Lambda$2/1367672657.handle(Unknown Source)
(...)
带有beanName和methodName的版本抛出:

2015-06-03 23:27:45.841 ERROR 6177 --- [ask-scheduler-1] o.s.integration.handler.LoggingHandler   : org.springframework.messaging.MessageHandlingException: ; nested exception is java.lang.RuntimeException: error from service
at org.springframework.integration.handler.MethodInvokingMessageProcessor.processMessage(MethodInvokingMessageProcessor.java:78)
at org.springframework.integration.dsl.support.BeanNameMessageProcessor.processMessage(BeanNameMessageProcessor.java:57)
(...)
Caused by: java.lang.RuntimeException: error from service
at com.lukzar.SomeService.someMethod(SomeService.java:15)
(...)
如果“行为像”的意思是将服务中的
错误
异常作为第一个
原因
,那么我们可以考虑从堆栈跟踪中删除
调用目标异常
。这将使基础异常成为
MessageHandlingException
原因

如果您的意思是使堆栈跟踪完全相同,则不

如果您指的是前者,那么请打开一个针对
JavaDSL
组件的示例,我们来看看。

如果“像”的意思是将
服务错误
异常作为第一个
原因
,那么我们可以考虑从堆栈跟踪中删除
调用TargetException
。这将使基础异常成为
MessageHandlingException
原因

如果您的意思是使堆栈跟踪完全相同,则不


如果您指的是前者,那么请打开一个针对
JavaDSL
组件的列表,我们来看看。

是的,我会像第一个一样对其进行编辑。我开了一期JIRA。是的,我和第一期一样。我开了一期JIRA。是的,我和第一期一样。我打开了一个JIRA问题。