@Override
public void onStartup(ServletContext servletContext) throws ServletException {
servletContext.getServletRegistration("default").addMapping("/resources/*");
AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext();
rootContext.register(RootApplicationContextConfig.class);
servletContext.addListener(new ContextLoaderListener(rootContext));
AnnotationConfigWebApplicationContext servletContextConfig = new AnnotationConfigWebApplicationContext();
servletContextConfig.register(ServletApplicationContextConfig.class);
ServletRegistration.Dynamic dispatcher = servletContext.addServlet("springDispatcher",
new DispatcherServlet(servletContextConfig));
dispatcher.setLoadOnStartup(1);
dispatcher.addMapping("/");
FilterRegistration.Dynamic registration = servletContext.addFilter("preSecFilter", new PreSescLoggingFilter());
registration.addMappingForUrlPatterns(null, false, "/*");
FilterRegistration.Dynamic reg = servletContext.addFilter("encoding",
new CharacterEncodingFilter("UTF-8", true));
reg.addMappingForUrlPatterns(null, false, "/*");
}
SpringBootStrap.java 文件源码
java
阅读 18
收藏 0
点赞 0
评论 0
项目:bookManager
作者:
评论列表
文章目录