异常处理程序不会捕获异常

时间:2013-04-09 21:30:39

标签: javascript spring exception-handling spring-webflow-2

我在webflow级别有一个excepton处理程序

<exception-handler bean="webflowExceptionHandlerBean"/>

我还有两个不同的流程,流程A和流程B.流程B是流程A的子流程。

流程A

<flow>
  <on-start>
    <!-- SOME SET -->
  </on-start>
  <view-state id="viewStateA">
    <transition id="goToFlowB" to="flowB"/>
  </view-state>
  <subflow-state id="flowB" subflow="flowB">
  </subflow-state>
</flow>

流程B

<flow>
  <on-start>
    <!-- SOME SET -->
  </on-start>
  <view-state id="flowB">
    <on-entry>
    <!-- HERE THE EXCEPTION IS THROWN -->
    </on-entry>
    <transition id="goToT1" to="t1"/>
  </view-state>
</flow>

因此,当流量B的入门抛出异常时, webflowExceptionHandlerBean

无法捕获

webflowExceptionHandlerBean 的配置实现 FlowExecutionExceptionHandler

我尝试使用 并且它有效,但我只在每个流上使用一个全局异常处理程序。

你知道发生了什么吗? 我错过了什么吗?

1 个答案:

答案 0 :(得分:0)

具有如下的抽象流程定义

<flow xmlns="http://www.springframework.org/schema/webflow"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/webflow
                            http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd" abstract="true">
<exception-handler bean="webflowExceptionHandlerBean"/>
</flow>

然后,将抽象流程继承到流程A和流程B,如下所示

<flow xmlns="http://www.springframework.org/schema/webflow"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/webflow
                            http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd" parent="abstract-flow">

您应该能够使用自定义异常处理程序

全局处理异常