How to add Struts2 to a web application without web.xml?

后端 未结 1 761
慢半拍i
慢半拍i 2021-01-23 06:16

Can someone help me with a minimal project setup with Spring Boot and Struts2? I have already create a Spring Boot application with a H2-database. I also added a h2Configu

相关标签:
1条回答
  • 2021-01-23 06:56

    Without web.xml you can only write a Struts2 filter using servlet 3.0 or higher

    @WebFilter("/*")
    public class Struts2Filter extends Struts2PrepareAndExecuteFilter {
    }
    

    The content could be empty, it's enough to add annotated filter without any inclusion in the web.xml file.

    If you want to integrate Struts2 with Spring, then you should use a plugin.

    Struts 2 provides a plugin that enables Spring to inject into the ActionSupport classes any dependent objects you've specified in the Spring configuration file. Consult Spring Plugin documentation for more information about how the plugin works.

    0 讨论(0)
提交回复
热议问题