我的主配置文件:
<display-name>Spring MVC Application</display-name>
<servlet>
<servlet-name>mvc-dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>WEB-INF/dispatcher.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>mvc-dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
这是我的网络流配置:
<bean class="org.springframework.webflow.mvc.servlet.FlowHandlerAdapter">
<property name="flowExecutor" ref="flowExecutor"/>
</bean>
<webflow-config:flow-executor id="flowExecutor" flow-registry="flowRegistry" />
<bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping">
<property name="flowRegistry" ref="flowRegistry" />
</bean>
<webflow-config:flow-registry id="flowRegistry">
<webflow-config:flow-location path="/WEB-INF/webflow_sample.xml"/>
</webflow-config:flow-registry>
<bean class="com.springapp.mvc.Person" id="person"/>
请注意Spring MVC的工作原理。我只是不知道如何将webflow配置连接到主配置文件。我尝试将其添加为init param,但这并不起作用。 Intelij告诉我,没有为webflow配置找到应用程序上下文&#39;前几名。我在Spring网站上关注参考,但我无法理解如何连接它们。
答案 0 :(得分:1)
我们在web.xml中的DispatcherServlet中列出了这两个文件:
<servlet>
<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/config/webmvc-config.xml
/WEB-INF/config/webflow-config.xml
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
答案 1 :(得分:0)
在你的'main'Spring配置文件中...只需使用'import'标签来引入另一个xml配置。像所以:
How to import spring-config.xml of one project into spring-config.xml of another project?