Relocate Spring Boot web server classes to their Spring Boot 4.0 packages

MSAL

Spring Boot 4.0 relocated the embedded web server (Tomcat, Jetty) and web server application context classes into dedicated modular packages. This recipe updates references to the relocated classes' new fully-qualified names, including the servlet and reactive WebServerFactory variants, which moved into servlet and reactive subpackages. Undertow support was removed in Spring Boot 4.0 and is intentionally not handled here.

org.openrewrite.java.spring.boot4.RelocateWebServerClasses
mod run . --recipe=org.openrewrite.java.spring.boot4.RelocateWebServerClasses

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

Recipe list

It runs these recipes, in this order.

  1. Change type org.springframework.boot.web.embedded.tomcat.CompressionConnectorCustomizer to org.springframework.boot.tomcat.CompressionConnectorCustomizer
  2. Change type org.springframework.boot.web.embedded.tomcat.ConfigurableTomcatWebServerFactory to org.springframework.boot.tomcat.ConfigurableTomcatWebServerFactory
  3. Change type org.springframework.boot.web.embedded.tomcat.ConnectorStartFailedException to org.springframework.boot.tomcat.ConnectorStartFailedException
  4. Change type org.springframework.boot.web.embedded.tomcat.ConnectorStartFailureAnalyzer to org.springframework.boot.tomcat.ConnectorStartFailureAnalyzer
  5. Change type org.springframework.boot.web.embedded.tomcat.DisableReferenceClearingContextCustomizer to org.springframework.boot.tomcat.DisableReferenceClearingContextCustomizer
  6. Change type org.springframework.boot.web.embedded.tomcat.LazySessionIdGenerator to org.springframework.boot.tomcat.LazySessionIdGenerator
  7. Change type org.springframework.boot.web.embedded.tomcat.SslConnectorCustomizer to org.springframework.boot.tomcat.SslConnectorCustomizer
  8. Change type org.springframework.boot.web.embedded.tomcat.TomcatConnectorCustomizer to org.springframework.boot.tomcat.TomcatConnectorCustomizer
  9. Change type org.springframework.boot.web.embedded.tomcat.TomcatContextCustomizer to org.springframework.boot.tomcat.TomcatContextCustomizer
  10. Change type org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedContext to org.springframework.boot.tomcat.TomcatEmbeddedContext
  11. Change type org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedWebappClassLoader to org.springframework.boot.tomcat.TomcatEmbeddedWebappClassLoader
  12. Change type org.springframework.boot.web.embedded.tomcat.TomcatProtocolHandlerCustomizer to org.springframework.boot.tomcat.TomcatProtocolHandlerCustomizer
  13. Change type org.springframework.boot.web.embedded.tomcat.TomcatWebServer to org.springframework.boot.tomcat.TomcatWebServer
  14. Change type org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory to org.springframework.boot.tomcat.servlet.TomcatServletWebServerFactory
  15. Change type org.springframework.boot.web.embedded.tomcat.TomcatReactiveWebServerFactory to org.springframework.boot.tomcat.reactive.TomcatReactiveWebServerFactory
  16. Change type org.springframework.boot.web.embedded.jetty.ConfigurableJettyWebServerFactory to org.springframework.boot.jetty.ConfigurableJettyWebServerFactory
  17. Change type org.springframework.boot.web.embedded.jetty.ForwardHeadersCustomizer to org.springframework.boot.jetty.ForwardHeadersCustomizer
  18. Change type org.springframework.boot.web.embedded.jetty.JettyServerCustomizer to org.springframework.boot.jetty.JettyServerCustomizer
  19. Change type org.springframework.boot.web.embedded.jetty.JettyWebServer to org.springframework.boot.jetty.JettyWebServer
  20. Change type org.springframework.boot.web.embedded.jetty.SslServerCustomizer to org.springframework.boot.jetty.SslServerCustomizer
  21. Change type org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory to org.springframework.boot.jetty.servlet.JettyServletWebServerFactory
  22. Change type org.springframework.boot.web.embedded.jetty.JettyReactiveWebServerFactory to org.springframework.boot.jetty.reactive.JettyReactiveWebServerFactory
  23. Change type org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory to org.springframework.boot.web.server.servlet.ConfigurableServletWebServerFactory
  24. Change type org.springframework.boot.web.servlet.server.ServletWebServerFactory to org.springframework.boot.web.server.servlet.ServletWebServerFactory
  25. Rename package name org.springframework.boot.web.servlet.context to org.springframework.boot.web.server.servlet.context
  26. Rename package name org.springframework.boot.web.reactive.context to org.springframework.boot.web.server.reactive.context