【问题标题】:Upgrade Spring Webflow from 1.0.6 to 2.3将 Spring Webflow 从 1.0.6 升级到 2.3
【发布时间】:2012-03-31 08:50:31
【问题描述】:

我们有一个基于 Spring 2.5.6 和 Webflow 2.3 的大型网络应用程序。现在我们要将 Spring 升级到 3,将 Webflow 升级到 2.3。升级 Spring 非常轻松,但是我们在使用其他库时遇到了一些问题。更改版本后,我们甚至无法使用 maven 构建我们的应用程序。有很大的不同,例如:包名称、方法可见性修饰符甚至删除的方法,我们在 1.0.6 中使用。 您现在有一些指南,我们应该如何替换更改的方法?我在 Spring 网站上发现了类似的东西,但它对我来说不是很有用。 也许有人这样做并且可以给我们一些提示? 感谢您的帮助:)

【问题讨论】:

  • 你试过在Spring论坛上询问webflow吗?

标签: java spring spring-webflow


【解决方案1】:

是的,这是可能的。仔细阅读该版本的 Spring 文档。您将需要使用 1.0.X 和 2.3.X 的参考文档,因为这会有所帮助。请特别注意升级指南建议的以下更改。

第 1 步。我编写了一个小工具来扩展下面的升级程序,以递归地查找我们所有的 Web 流并将标签转换为 2.3.X 兼容:

java org.springframework.webflow.upgrade.WebFlowUpgrader flow-to-upgrade.xml

这个类可以在 WebFlow jars 源代码中找到。

第 2 步。我更新了架构:

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:webflow="http://www.springframework.org/schema/webflow-config"
       xsi:schemaLocation="
           http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
           http://www.springframework.org/schema/webflow-config
           http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.3.xsd">

步骤 3. 确认 flowExecutor 标签已更新为 2.3 合规性:

<webflow:flow-executor id="flowExecutor" />

步骤 4. 更新基于静态路径的声明的 flowRegistry 并确保标签合规性:

<webflow:flow-registry id="flowRegistry">
    <webflow:flow-location path="/WEB-INF/hotels/booking/booking.xml" />
</webflow:flow-registry>

第 5 步。更改 FlowController 类以匹配新的 Web Flow jar: 从org.springframework.webflow.executor.mvc.FlowController 更改为现在org.springframework.webflow.mvc.servlet.FlowController

步骤 6. 更新 FlowController bean 类引用。添加 WebFlow1FlowUrlHandler 确保 Web Flow 1.0.x 流将运行并与新的 Web Flow 2 jar 向后兼容。

<bean name="/pos.htm" class="org.springframework.webflow.mvc.servlet.FlowController">
    <property name="flowExecutor" ref="flowExecutor" />
    <property name="flowUrlHandler">
        <bean class="org.springframework.webflow.context.servlet.WebFlow1FlowUrlHandler" />
    </property>
</bean>

http://docs.spring.io/spring-webflow/docs/2.3.x/reference/htmlsingle/#upgrade-guide

http://static.springsource.org/spring-webflow/docs/1.0.1/reference/index.html

【讨论】:

    【解决方案2】:

    在这里很难给出具体的建议。升级总是一件困难的事情。首先,我鼓励您阅读 webflow 文档中有关升级的部分,例如从这里http://static.springsource.org/spring-webflow/docs/2.3.x/reference/pdf/spring-webflow-reference.pdf(第 16 章 - 从 1.0 升级)这样做您可以看到自 1.0 版以来发生了什么变化。然后你可以决定升级是否合理。祝你好运 ! :)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-03
      • 2014-02-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多