Request is going to Struts Dispatcher

后端 未结 2 751
花落未央
花落未央 2021-01-28 04:12

I have both Struts 2 and Spring MVC configured. My web.xml looks like below. When I hit a REST URL to upload file, it invokes struts dispatcher instead of Spring.

2条回答
  •  失恋的感觉
    2021-01-28 04:52

    Adding to Roman’s answer, when configuring Struts and Spring MVC in the same project, it is common to use a struts exclude filter. When the request is made Struts will try to handle the request, when it is excluded Spring MVC will take over and handle the request. Is is worth noting that the Struts exclude filter can go in a properties file, such as a struts.properties. Often Regex can be used here in order to exclude a common phrase (like if all your actions or controllers in a class share a common part, you can exclude all using the Regex).

提交回复
热议问题