我目前正在为未来的项目评估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>
将http://www.springframework.org/schema/webflow-config/spring-webflow-config.xsd更改为http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.3.xsd会从Eclipse中删除验证错误,但SAXParser在启动时仍会抱怨。
周围有什么办法吗?有人可以帮我解决一个工作配置或指向一个工作教程(如果是样本错误,还是一个正确的教程,或者如果我做错了就向我展示如何正确设置SWF)?
现在,我不会将SWF从我们可能的框架列表中倾倒出来,因为“没有开箱即用”,而且 - 看看Spring的用户群和流行程度,这有点难以置信。
非常感谢。