AbstractAnnotationConfigDispatcherServletInitializer class implements WebMvcConfigurer which internally implements WebApplicationInitializer. Spring provides SpringServletContainerInitializer that knows how to handle WebApplicationInitializer classes.
as we would traditionally do in a web.xml. In this class, we can register filters, listeners, servlets etc. For this, there is the ServletContainerInitializer in the Servlet specification. īeginning with Servlet 3, it became possible to configure the Servlet Container with (almost) no XML.
Note that we are using Spring Framework 6 so the baseline Java version is Java 17. Start with adding the latest version of spring-webmvc, spring-orm, hibernate-core, hibernate-validator, jakarta.persistence-api and rvlet-api dependencies.