All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ajaxjs.spring.BaseWebInitializer Maven / Gradle / Ivy

Go to download

AJAXJS aims to full-stack, not only the server-side framework, but also integrates the front-end library. It'€™s written in HTML5 + Java, a successor to the JVM platform, efficient, secure, stable, cross-platform and many other advantages, but it abandoned the traditional enterprise architecture brought about by the large and bloated, emphasizing the lightweight, and fast, very suitable for the Internet fast application.

The newest version!
package com.ajaxjs.spring;

import com.ajaxjs.util.logger.LogHelper;
import org.springframework.web.WebApplicationInitializer;
import org.springframework.web.context.support.XmlWebApplicationContext;
import org.springframework.web.servlet.DispatcherServlet;

import javax.servlet.ServletContext;
import javax.servlet.ServletRegistration;

/**
 * 配置 Spring MVC
 *
 * @author Frank Cheung
 */
public abstract class BaseWebInitializer implements WebApplicationInitializer {
    private static final LogHelper LOGGER = LogHelper.getLog(BaseWebInitializer.class);

    @Override
    public void onStartup(ServletContext servletContext) {
        LOGGER.info("WEB 程序启动中……");
        XmlWebApplicationContext ctx = new XmlWebApplicationContext();
        ctx.setConfigLocation("/WEB-INF/spring-mvc.xml");

        String initParameter = servletContext.getInitParameter("SpringMVC_Mapping");

        ServletRegistration.Dynamic servlet = servletContext.addServlet("dispatcher", new DispatcherServlet(ctx));
        servlet.addMapping(initParameter == null ? "/" : initParameter);
        servlet.setLoadOnStartup(1);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy