Migrate web.xml to WebApplicationInitializer

Proprietary

Migrate web.xml to WebApplicationInitializer for Spring applications. This allows for programmatic configuration of the web application context, replacing the need for XML-based configuration. This recipe only picks up web.xml files located in the src/main/webapp/WEB-INF directory to avoid inference with tests. It creates a WebXmlWebAppInitializer class in src/main/java with respect to submodules if they contain java files. If it finds an existing WebXmlWebAppInitializer, it skips the creation.

io.moderne.java.spring.framework.webxml.WebXmlToWebApplicationInitializer

Optional

useJakartaEEBoolean

If true, the recipe will migrate to Jakarta EE 9+ namespaces. If false, it will use the javax.servlet namespace. If not set, the recipe will auto-detect based on the Spring Framework version: Spring 6+ uses Jakarta EE, Spring 5.x and earlier uses javax.

mod run . --recipe=io.moderne.java.spring.framework.webxml.WebXmlToWebApplicationInitializer

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.