package co.fredyjimenezrendon.proyectobase.config;

import java.util.EnumSet;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRegistration;
import javax.servlet.SessionTrackingMode;

import org.springframework.web.WebApplicationInitializer;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import org.springframework.web.filter.DelegatingFilterProxy;
import org.springframework.web.servlet.DispatcherServlet;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

public class SpringWebAppInitializer extends WebMvcConfigurerAdapter implements WebApplicationInitializer {


	@Override
	public void onStartup(ServletContext servletContext) throws ServletException {
        AnnotationConfigWebApplicationContext appContext = new AnnotationConfigWebApplicationContext();
        servletContext.setSessionTrackingModes(EnumSet.of(SessionTrackingMode.COOKIE));
        appContext.register(ApplicationContextConfig.class);
        servletContext.addFilter("securityFilter", new DelegatingFilterProxy("springSecurityFilterChain")).addMappingForUrlPatterns(null, false, "/*");
        ServletRegistration.Dynamic dispatcher = servletContext.addServlet("SpringDispatcher", new DispatcherServlet(appContext));
        dispatcher.setLoadOnStartup(1);
        dispatcher.addMapping("/");
        
	}
	

	@Override
	public void addResourceHandlers(ResourceHandlerRegistry registry) {
		registry.addResourceHandler("/css/**").addResourceLocations("/css/");
		registry.addResourceHandler("/images/**").addResourceLocations("/images/");
		registry.addResourceHandler("/js/**").addResourceLocations("/js/");
	}
	
}
@@ -883,24 +883,18 @@
 tion %7B%0D%0A
-        
+%09%09
 Annotati
@@ -978,32 +978,26 @@
 Context();%0D%0A
-        
+%09%09
 servletConte
@@ -1065,24 +1065,18 @@
 KIE));%0D%0A
-        
+%09%09
 appConte
@@ -1121,24 +1121,18 @@
 lass);%0D%0A
-        
+%09%09
 servletC
@@ -1270,226 +1270,8 @@
 *%22);
-%0D%0A        ServletRegistration.Dynamic dispatcher = servletContext.addServlet(%22SpringDispatcher%22, new DispatcherServlet(appContext));%0D%0A        dispatcher.setLoadOnStartup(1);%0D%0A        dispatcher.addMapping(%22/%22);%0D%0A      
   %0D%0A
@@ -1591,9 +1591,11 @@
 %0A%09%7D%0D%0A%09%0D%0A
-
 %7D
+%0D%0A

Update SpringWebAppInitializer.java