uk.co.parso.barebones.ApplicationInitializer.java Source code

Java tutorial

Introduction

Here is the source code for uk.co.parso.barebones.ApplicationInitializer.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package uk.co.parso.barebones;

import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;

/**
 * Main initialization class.
 * 
 * Ultimately this implements WebApplicationInitializer which the 
 * servlet container will look for.
 * 
 * @author sam
 */
public class ApplicationInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {

    /**
     * Configuration classes for the root application context.
     * 
     * @return Configuration classes for the root application context
     */
    @Override
    protected Class<?>[] getRootConfigClasses() {
        return new Class[] { SpringConfig.class };
    }

    /**
     * @return Servlet mapping for the dispatcher servlet
     */
    @Override
    protected String[] getServletMappings() {
        return new String[] { "/*" };
    }

    @Override
    protected Class<?>[] getServletConfigClasses() {
        // In my application I'm not using multiple servlets, so I put all 
        // my configuration in the root context.
        return null;
    }
}