content: package spring.project.configure;
  
  import org.springframework.context.annotation.AnnotationConfigApplicationContext;
  import org.springframework.web.WebApplicationInitializer;
  import org.springframework.web.context.WebApplicationContext;
  import org.springframework.web.servlet.DispatcherServlet;
  
  import javax.servlet.ServletContext;
  import javax.servlet.ServletException;
  import javax.servlet.ServletRegistration;
  
  /**
   * @Created 04 / 05 / 2020 - 5:44 PM
   * @project EmployeeSearch
   * @Author Hamdamboy
   */
  public class WebAppInitializer implements WebApplicationInitializer {
  
  
      private WebApplicationContext appContext;
  
      @Override
      public void onStartup(ServletContext servletContext) throws ServletException {
          AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext();
          applicationContext.register(WebMvcConfig.class);
  
          ServletRegistration.Dynamic dispatcher = servletContext.addServlet(
                  "SpringDispatcher", new DispatcherServlet(appContext));
          dispatcher.setLoadOnStartup(1);
          dispatcher.addMapping("/");
      }
  }
  