Java Spring: 尝试通过 xml 配置 webflow,找不到调度程序-servlet.xml

Java Spring: Trying to configure webflow by xml, can't find dispatcher-servlet.xml

我刚开始尝试查看 spring 流程是什么 about.This 我的书描述了我必须如何配置 dispathcer-servlet.xml 并在其中创建一些流程那里。

问题是我在我的 java spring 应用程序中找不到这个调度程序-servlet.xml 文件来启动 configuration.Where 是吗?

我在这里和 google 上搜索过,但我只找到已经有 n 个调度程序-servlet.xml 文件的人,他们正在询问如何配置它。

如有任何帮助,我们将不胜感激!

您不需要 dispatcher-servlet.xml 配置 DispatcherServlet。如果未定义,它只是一个默认名称 Spring 将查找。在 web.xml 中定义 DispatcherServlet 时,可以在 contextConfigLocation init-param 中定义配置。或者,如果您有单个 DispatcherServlet,则可以使用全局 spring xml 配置。如果您有有效的 java spring 应用程序,请查找

  <context-param>
    <param-name>contextConfigLocation</param-name>
...
  </context-param>

  <servlet>
    <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
...
  </servlet>

在你的 web.xml

如果在web.xml中没有找到,则需要自行配置。我还认为这本书可能适用于 webflow 1.x。尝试使用官方 Spring Webflow 参考,这是一个很好的起点,并且是 up-to-date:

https://docs.spring.io/spring-webflow/docs/current/reference/html/

具体的Dispatcher servlet配置请看本章:

https://docs.spring.io/spring-webflow/docs/current/reference/html/spring-mvc.html#spring-mvc-config-web.xml