我刚开始添加的Webflow到Spring MVC的项目,我让我的flow.xml组件此编译错误:春Webflow的2.4.2缺少启动状态
Start state is missing. Add at least one state to the flow
我发现了一个相同的职位上SO从一年前:webflow.xsd - Start state is missing. Add at least one state to the flow。 没有人回答这个问题,但我发现它在Spring Webflow的Jira存储库中:webflow.xsd - Start state is missing. Add at least one state to the flow。它被标记为不能重现。
这是我非常简单的webflow.xml摘录。
<?xml version="1.0" encoding="UTF-8"?>
<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.4.xsd">
<on-start>
<evaluate expression="recipeService.createRecipe(currentUser.name)" result="flowScope.recipe" />
</on-start>
<view-state id="basics" view="recipe/basics" model="recipe">
<transition on="proceed" to="ingredients"></transition>
<transition on="cancel" to="cancel"></transition>
</view-state>
... more states ...
<end-state id="end" view="recipe/end"/>
<end-state id="cancel" view="recipe/end"/>
</flow>
该文档指出启动状态是可选的 - 第一个视图状态将被认为是开始。如果我将spring-webflow-2.4.xsd更改为2.0,则错误消失,但如果尝试对任何视图状态条目使用验证提示,则会发生不同的错误。以下示例中的“Basic1”和“Basic2”是配方模型上的验证组。
<view-state id="basics" view="recipe/basics" model="recipe" validation-hints="'basic1,basic2'">
我使用
- STS 3.6.4
- 春4.1.6.RELEASE
- 访问Spring WebFlow 2.4.2.RELEASE
- 春季安全4.0.2.RELEASE
- Java 1.7
- 休眠4.3.10.FINAL
我使用的是基于java的配置的一切,但我不认为这是问题所在,除非我在Webflow 2.4.2需要的版本不匹配?我可以发布我的WebMvcConfig和WebFlowConfig或pom.xml或任何其他信息,如果这将有所帮助。
任何援助将不胜感激。
编辑#1:从Java配置
From WebFlowConfig.java:
@Bean
public FlowDefinitionRegistry flowRegistry() {
return getFlowDefinitionRegistryBuilder(flowBuilderServices())
.setBasePath("/WEB-INF/views")
.addFlowLocationPattern("/**/*-flow.xml")
.build();
}
From WebMvcConfig.java
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
super.addViewControllers(registry);
registry.addViewController("/recipe/basics.htm");
registry.addViewController("/recipe/ingredients.htm");
registry.addViewController("/recipe/instructions.htm");
registry.addViewController("/recipe/optional.htm");
registry.addViewController("/recipe/end.htm");
}
摘录使用2.0所有的页面都以正确的顺序执行。
编辑#2
我忘了提,甚至与2.4 XSD编译错误的Webflow没有得到执行,同样在一年前后。我还发现有关STS的这个问题:webflow config gives incorrect "Start state definition is missing." error。所示的修复版本是3.3.0.M1,所以我会假设(?)该修补程序仍然包含在STS 3.6.4中。
对我也一样。将方案从2.0更改为2.4,并删除了属性中的流支持 - 作品。 –