package com.apobates.forum.thrones.admin;

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

/**
 * 后端Spring 项目启动类
 * @author xiaofanku
 * @since 20200603
 */
public class AdminApp extends AbstractAnnotationConfigDispatcherServletInitializer{
    
    @Override
    protected Class<?>[] getRootConfigClasses() {
        return new Class<?>[]{ThronesAdminAppConfig.class};
    }
    
    @Override
    protected Class<?>[] getServletConfigClasses() {
        return new Class<?>[]{ThronesAdminFrontConfig.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 org.sitemesh.config.ConfigurableSiteMeshFilter()};
    }
    
    @Override
    protected ApplicationContextInitializer<?>[] getRootApplicationContextInitializers() {
        return new ApplicationContextInitializer<?>[]{new ThronesAdminAppContextInitializer()};
    }
}