Code example for AbstractAnnotationConfigDispatcherServletInitializer

0
package thymeleafexamples.layouts.config; 
 
import org.springframework.core.annotation.Order; 
import org.springframework.web.filter.CharacterEncodingFilter; 
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; 
 
import javax.servlet.Filter; 
import javax.servlet.ServletRegistration; 
 
@Order(2) 
public class WebAppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer { 
 
    @Override 
    protected String[] getServletMappings() { 
        return new String[]{"/"}; 
    } 
 
    @Override 
    protected Class<?>[] getRootConfigClasses() { 
        return new Class<?>[] {ApplicationConfig.class, DataSourceConfig.class, JpaConfig.class, SecurityConfig.class}; 
    } 
 
    @Override 
    protected Class<?>[] getServletConfigClasses() { 
        return new Class<?>[] {WebMvcConfig.class};