Created
January 9, 2014 08:54
-
-
Save letenkov/8331324 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AppInitializer implements WebApplicationInitializer { | |
@Override | |
public void onStartup(javax.servlet.ServletContext servletContext) throws ServletException { | |
AnnotationConfigWebApplicationContext appContext = new AnnotationConfigWebApplicationContext(); | |
appContext.register(AppConfig.class); | |
servletContext.addListener(new ContextLoaderListener(appContext)); | |
AnnotationConfigWebApplicationContext webConfig = new AnnotationConfigWebApplicationContext(); | |
webConfig.register(WebConfig.class); | |
ServletRegistration.Dynamic servlet = servletContext.addServlet("dispatcher", new DispatcherServlet(webConfig)); | |
servlet.setLoadOnStartup(1); | |
servlet.addMapping("/*"); | |
FilterRegistration.Dynamic csrfTokenGeneratorFilter = servletContext.addFilter("csrfTokenGeneratorFilter", CsrfTokenGeneratorFilter.class); | |
csrfTokenGeneratorFilter.addMappingForUrlPatterns(null, false, "/*"); | |
FilterRegistration.Dynamic springSecurityFilterChain = servletContext.addFilter("springSecurityFilterChain", DelegatingFilterProxy.class); | |
springSecurityFilterChain.addMappingForUrlPatterns(null, false, "/*"); | |
FilterRegistration.Dynamic hiddenHttpMethodFilter = servletContext.addFilter("hiddenHttpMethodFilter", HiddenHttpMethodFilter.class); | |
hiddenHttpMethodFilter.addMappingForUrlPatterns(null, false, "/*"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment