spring webflow无法使用Spring 4

时间:2015-05-01 11:50:17

标签: spring spring-webflow

我最近升级到了春季4,并且还将网络流量升级到2.4.1 以下是webflow的依赖关系

<dependency>
  <groupId>org.springframework.webflow</groupId>
  <artifactId>spring-webflow</artifactId>
  <version>2.4.1.RELEASE</version>
  <scope>compile</scope>
</dependency>
<dependency>
  <groupId>org.springframework.webflow</groupId>
  <artifactId>org.springframework.webflow</artifactId>
  <version>2.0.0.RELEASE</version>
  <scope>compile</scope>
</dependency>
<dependency>
  <groupId>org.springframework.webflow</groupId>
  <artifactId>spring-binding</artifactId>
  <version>2.4.1.RELEASE</version>
  <scope>compile</scope>
</dependency>
<dependency>
  <groupId>org.springframework.webflow</groupId>
  <artifactId>org.springframework.js</artifactId>
  <version>2.0.5.RELEASE</version>
  <scope>compile</scope>
</dependency>
<dependency>
  <groupId>org.springframework.webflow</groupId>
  <artifactId>spring-js-resources</artifactId>
  <version>2.4.1.RELEASE</version>
  <scope>compile</scope>
</dependency>
<dependency>
  <groupId>org.springframework.webflow</groupId>
  <artifactId>spring-js</artifactId>
  <version>2.4.1.RELEASE</version>
  <scope>compile</scope>
</dependency>

springwebflow的ApplicationContext文件

<?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:p="http://www.springframework.org/schema/p"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    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/context
    http://www.springframework.org/schema/context/spring-context.xsd
    http://www.springframework.org/schema/mvc
    http://www.springframework.org/schema/mvc/spring-mvc.xsd
    http://www.springframework.org/schema/webflow-config
    http://www.springframework.org/schema/webflow-config/spring-webflow-config.xsd">

   <bean id="randomUserGenerator" class="com.userGenerator.randomUserGenerator.RandomUserGenerator" >
    </bean>



    <bean id="appSign" class="com.dao.service.ApplicationSignManager">
    <description>List of Dao in ApplicationLogin Manager</description>
    <property name="iSecurityQuestionDao" ref="securityQuestionsDao"/>
    <property name="randomUserGeneratorInterface" ref="randomUserGenerator"/>
    </bean> 

    <bean id="webflowEventDelegator" class="com.bhaskar.web.WebFLowEventDelegatorController">
        <property name="iApplicationSignInterface" ref="appSign"/>
    </bean>

    <bean id="iFileReadManager" class="com.dao.service.FileReadManager">
    <property name="shoppingBrandMasterDao" ref="shoppingBrandMasterDao"/>
    </bean>

    <bean id="fileUploadController" class="com.bhaskar.web.FileUploadController">
        <property name="iFileReadManager" ref="iFileReadManager"/>

    </bean>



<bean id="tilesConfigurer"
        class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
        <property name="definitions" >
            <list>
            <value>/WEB-INF/flowTiles/tiles.xml</value>
            </list>
        </property>
    </bean>

    <bean id="tilesViewResolver" class="org.springframework.js.ajax.AjaxUrlBasedViewResolver">
        <property name="viewClass" value="org.springframework.webflow.mvc.view.FlowAjaxTilesView" />
    </bean> 

         <bean id="viewFactoryCreator"
        class="org.springframework.webflow.mvc.builder.MvcViewFactoryCreator">
        <property name="viewResolvers" ref="tilesViewResolver" />
    </bean>


    <bean id="handlerMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
        <property name="mappings">
            <value>/*.org=flowController</value>
        </property>
        <property name="order" value="1"></property>

    </bean>




    <bean id="flowController" class="org.springframework.webflow.mvc.servlet.FlowController">
        <property name="flowExecutor" ref="flowExecutor"/>
    </bean>

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

    <webflow:flow-registry id="flowRegistry" flow-builder-services="flowBuilderServices"  >
        <webflow:flow-location id="register" path="/WEB-INF/flows/register.xml"></webflow:flow-location>
        <webflow:flow-location id="fileUpload" path="/WEB-INF/flows/fileUpload.xml"/>
    </webflow:flow-registry>


    <webflow:flow-builder-services id="flowBuilderServices"
    view-factory-creator="viewFactoryCreator" development="true"/>
</beans>

但现在它正在抛出异常

Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/applicationFlowContext.xml]; nested exception is java.lang.NoClassDefFoundError: org.springframework.core.enums.LabeledEnum

请帮助解决此问题。

1 个答案:

答案 0 :(得分:0)

你可以修改你的pom来拥有它。我们的项目没有问题地使用Spring 4和Spring Web Flow 2.4.1。我也有Spring Security(如果你不打算使用它,你可以删除它)。您可以根据需要添加其他资源。删除WEB-INF/lib文件夹中的所有jar并运行mvn compile

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-framework-bom</artifactId>
        <version>4.1.0.RELEASE</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
     </dependencies>
  </dependencyManagement>

  <dependencies>
     <!-- Spring -->
     <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-core</artifactId>
     </dependency>
     <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-context</artifactId>
     </dependency>
     <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-jdbc</artifactId>
     </dependency>
     <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-beans</artifactId>
     </dependency>
     <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-test</artifactId>
     </dependency>
     <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-aop</artifactId>
     </dependency>
     <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-tx</artifactId>
     </dependency>
     <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-expression</artifactId>
     </dependency>
     <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-webmvc</artifactId>
     </dependency>
     <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-web</artifactId>
       <exclusions>
          <exclusion>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
          </exclusion>
       </exclusions>
     </dependency>
     <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-orm</artifactId>
     </dependency>
     <dependency>
       <groupId>org.springframework.security</groupId>
       <artifactId>spring-security-core</artifactId>
       <version>3.2.4.RELEASE</version>
     </dependency>
     <dependency>
       <groupId>org.springframework.security</groupId>
       <artifactId>spring-security-config</artifactId>
       <version>3.2.4.RELEASE</version>
       <scope>runtime</scope>
     </dependency>
     <dependency>
       <groupId>org.springframework.security</groupId>
       <artifactId>spring-security-web</artifactId>
       <version>3.2.4.RELEASE</version>
     </dependency>
     <dependency>
       <groupId>org.springframework.security</groupId>
       <artifactId>spring-security-taglibs</artifactId>
       <version>3.2.4.RELEASE</version>
     </dependency>
     <dependency>
       <groupId>commons-dbcp</groupId>
       <artifactId>commons-dbcp</artifactId>
       <version>1.2.2</version>
     </dependency>
     <dependency>
       <groupId>org.springframework.webflow</groupId>
       <artifactId>spring-webflow</artifactId>
       <version>2.4.1.RELEASE</version>
       <exclusions>
          <exclusion>
             <groupId>commons-logging</groupId>
             <artifactId>commons-logging</artifactId>
           </exclusion>
       </exclusions>
     </dependency>
     <dependency>
       <groupId>org.springframework.webflow</groupId>
       <artifactId>spring-binding</artifactId>
       <version>2.4.1.RELEASE</version>
       <exclusions>
          <exclusion>
              <groupId>commons-logging</groupId>
              <artifactId>commons-logging</artifactId>
          </exclusion>
       </exclusions>
     </dependency>
  </dependencies>