com.amuponda.estorehack.client.web.config.EstoreWebApplicationInitializer.java Source code

Java tutorial

Introduction

Here is the source code for com.amuponda.estorehack.client.web.config.EstoreWebApplicationInitializer.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 com.amuponda.estorehack.client.web.config;

import com.amuponda.estorehack.business.config.EstoreHackDataConfig;
import com.amuponda.estorehack.business.config.EstoreHackRootConfig;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;

/**
 *
 * @author amuponda
 */
public class EstoreWebApplicationInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {

    /**
     * Loads the beans in the application context created by the ContextLoadListener
     * @return array of configuration classes that contain beans
     */
    @Override
    protected Class<?>[] getRootConfigClasses() {
        return new Class[] { EstoreHackRootConfig.class, EstoreHackDataConfig.class };
    }

    /**
     * Ask DispatcherServlet to load the application context it creates with beans defined in
     * @Configuration classes
     * @return  array of configuration classes
     */
    @Override
    protected Class<?>[] getServletConfigClasses() {
        return new Class[] { EstoreWebConfig.class };
    }

    /**
    * Makes DispatcherServlet the default entry servlet for all requests
    * @return  URLs accepted/handled by the DispatcherServlet
    */
    @Override
    protected String[] getServletMappings() {
        return new String[] { "/" };
    }
}