spring web flow启用范围

时间:2013-05-15 21:41:44

标签: spring scope spring-webflow spring-webflow-2

Spring Web flow提供了额外的bean作用域,如flow,conversation,flash等。我可以使用var在flow.xml中定义流作用域bean,或者我可以将值设置为新的作用域变量。我如何在spring应用程序上下文xml文件中定义它。我尝试使用这种模式:

<bean id="abc" class="abc" scope="flow"/>

我收到错误,没有定义范围。我在谷歌搜索并发现了这个东西 http://blog.springsource.org/2007/05/08/spring-web-flow-bean-scopes-and-jsf/

但不知道如何在spring web flow 2.3中启用它

1 个答案:

答案 0 :(得分:0)

尝试在您的应用程序上下文中定义它:

<bean class="org.springframework.beans.factory.config.CustomScopeConfigurer">
    <property name="scopes">
        <map>
            <entry key="flow">
                <bean class="org.springframework.webflow.config.scope.FlowScope"/>
            </entry>
        </map>
    </property>
</bean>