package com.apobates.forum.thrones;

import javax.servlet.Filter;
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.web.filter.DelegatingFilterProxy;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;

/**
 * Spring 项目启动类
 *
 * @author xiaofanku
 * @since 20200511
 */
public class App extends AbstractAnnotationConfigDispatcherServletInitializer {
    @Override
    protected Class<?>[] getRootConfigClasses() {
        return new Class<?>[]{ThronesAppConfig.class};
    }
    
    @Override
    protected Class<?>[] getServletConfigClasses() {
        return new Class<?>[]{ThronesFrontConfig.class};
    }
    
    @Override
    protected String[] getServletMappings() {
        return new String[]{"/"};
    }
    
    @Override
    protected Filter[] getServletFilters() {
        //
        return new Filter[]{
            new org.springframework.web.filter.CharacterEncodingFilter("UTF-8", true), 
            new DelegatingFilterProxy("springSessionRepositoryFilter"),
            new DelegatingFilterProxy("tokenParamFilter"),
            new org.sitemesh.config.ConfigurableSiteMeshFilter()};
    }
    
    @Override
    protected ApplicationContextInitializer<?>[] getRootApplicationContextInitializers() {
        return new ApplicationContextInitializer<?>[]{new ThronesAppContextInitializer()};
    }
}