Spring Webflow 2.3.0 示例无法启动...不知道如何修复

发布于 2024-12-05 20:30:26 字数 3366 浏览 1 评论 0原文

我目前正在评估 Spring(重点是 WebFlow)以用于未来的项目。在阅读了大量文档和文章(其中大部分没有多大帮助)后,我下载了 Spring WebFlow 的当前版本(撰写本文时为 2.3.0)并尝试运行示例。除了可解决但令人沮丧的依赖项和类路径问题之外,我还遇到了与示例一起分发的配置文件的第一个障碍。首先,booking-mvc-sample 的 webflow-config.xml 甚至无效。

<?xml version="1.0" encoding="UTF-8"?>
<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.xsd
           http://www.springframework.org/schema/webflow-config
           http://www.springframework.org/schema/webflow-config/spring-webflow-config.xsd">

    <!-- Executes flows: the entry point into the Spring Web Flow system -->
    <webflow:flow-executor id="flowExecutor">
        <webflow:flow-execution-listeners>
            <webflow:listener ref="securityFlowExecutionListener" />
        </webflow:flow-execution-listeners>
    </webflow:flow-executor>

    <!-- The registry of executable flow definitions -->
    <webflow:flow-registry id="flowRegistry" flow-builder-services="flowBuilderServices" base-path="/WEB-INF">
        <webflow:flow-location-pattern value="/**/*-flow.xml" />
    </webflow:flow-registry>

    <!-- Plugs in a custom creator for Web Flow views -->
    <webflow:flow-builder-services id="flowBuilderServices" view-factory-creator="mvcViewFactoryCreator"
        development="true" validator="validator" />

    <!-- Configures Web Flow to use Tiles to create views for rendering; Tiles allows for applying consistent layouts to your views -->
    <bean id="mvcViewFactoryCreator" class="org.springframework.webflow.mvc.builder.MvcViewFactoryCreator">
        <property name="viewResolvers" ref="tilesViewResolver"/>
        <property name="useSpringBeanBinding" value="true" />
    </bean>

    <!-- Installs a listener to apply Spring Security authorities -->
    <bean id="securityFlowExecutionListener" class="org.springframework.webflow.security.SecurityFlowExecutionListener" />

    <!-- Bootstraps JSR-303 validation and exposes it through Spring's Validator interface -->
    <bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"/>

</beans>
  • cvc-complex-type.2.4.c:匹配通配符严格,但找不到元素“webflow:flow-executor”的声明。
  • cvc-complex-type.2.4.c:匹配通配符严格,但找不到元素“webflow:flow-registry”的声明。
  • cvc-complex-type.2.4.c:匹配通配符严格,但找不到元素“webflow:flow-builder-services”的声明。

更改 http://www.springframework.org/schema/webflow- config/spring-webflow-config.xsdhttp://www.springframework.org/schema/webflow-config/spring-webflow-config-2.3.xsd 从 Eclipse 中删除验证错误,但 SAXParser 在启动时仍然抱怨。

有什么办法解决吗?有人可以帮我解决一个工作配置或指向一个工作教程(如果是示例错误,则为正确的教程;如果我做错了,则为向我展示如何正确设置 SWF 的教程)?

现在,我距离将 SWF 从我们的可能框架列表中剔除为“不是开箱即用”不远了——看看 Spring 的用户群和流行程度,这在某种程度上很难相信。

多谢。

I'm currently evaluating Spring (with a focus on WebFlow) for future projects. After reading lots of docs and articles (most of which didn't help much) I downloaded the current release of Spring WebFlow (2.3.0 at the time of writing) and tried to get the samples running. Apart from solvable, yet frustrating, dependency- and classpath-issues, I hit the first roadblock with the config-files distributed with the samples. First of all, the webflow-config.xml of the booking-mvc-sample isn't even valid.

<?xml version="1.0" encoding="UTF-8"?>
<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.xsd
           http://www.springframework.org/schema/webflow-config
           http://www.springframework.org/schema/webflow-config/spring-webflow-config.xsd">

    <!-- Executes flows: the entry point into the Spring Web Flow system -->
    <webflow:flow-executor id="flowExecutor">
        <webflow:flow-execution-listeners>
            <webflow:listener ref="securityFlowExecutionListener" />
        </webflow:flow-execution-listeners>
    </webflow:flow-executor>

    <!-- The registry of executable flow definitions -->
    <webflow:flow-registry id="flowRegistry" flow-builder-services="flowBuilderServices" base-path="/WEB-INF">
        <webflow:flow-location-pattern value="/**/*-flow.xml" />
    </webflow:flow-registry>

    <!-- Plugs in a custom creator for Web Flow views -->
    <webflow:flow-builder-services id="flowBuilderServices" view-factory-creator="mvcViewFactoryCreator"
        development="true" validator="validator" />

    <!-- Configures Web Flow to use Tiles to create views for rendering; Tiles allows for applying consistent layouts to your views -->
    <bean id="mvcViewFactoryCreator" class="org.springframework.webflow.mvc.builder.MvcViewFactoryCreator">
        <property name="viewResolvers" ref="tilesViewResolver"/>
        <property name="useSpringBeanBinding" value="true" />
    </bean>

    <!-- Installs a listener to apply Spring Security authorities -->
    <bean id="securityFlowExecutionListener" class="org.springframework.webflow.security.SecurityFlowExecutionListener" />

    <!-- Bootstraps JSR-303 validation and exposes it through Spring's Validator interface -->
    <bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"/>

</beans>
  • cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'webflow:flow-executor'.
  • cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'webflow:flow-registry'.
  • cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'webflow:flow-builder-services'.

Changing http://www.springframework.org/schema/webflow-config/spring-webflow-config.xsd to http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.3.xsd removes the validation errors from Eclipse but the SAXParser still complains at startup.

Is there any way around it? Can someone help me out with a working config or point to a working tutorial (either a correct one if it's the samples fault or one that shown me how to setup SWF correctly if I'm doing it wrong)?

Right now I'm not far from dumping SWF from our list of possible frameworks as "not running out of the box" and - looking at the userbase and prevalence of Spring, this is somehow hard to believe.

Thanks a lot.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文