@Override
public void onStartup(ServletContext servletContext) throws ServletException {
if (springProfiles != null) {
applicationContext.getEnvironment().setActiveProfiles(springProfiles.toArray(new String[0]));
}
applicationContext.setServletContext(servletContext);
dispatcherConfig = new DefaultDispatcherConfig(servletContext);
applicationContext.setServletConfig(dispatcherConfig);
// Configure the listener for the request handled events. All we do here is release the latch
applicationContext.addApplicationListener(new ApplicationListener<ServletRequestHandledEvent>() {
@Override
public void onApplicationEvent(ServletRequestHandledEvent servletRequestHandledEvent) {
try {
currentResponse.flushBuffer();
} catch (IOException e) {
log.error("Could not flush response buffer", e);
throw new RuntimeException("Could not flush response buffer", e);
}
}
});
// Manage the lifecycle of the root application context
this.addListener(new ContextLoaderListener(applicationContext));
// Register and map the dispatcher servlet
dispatcherServlet = new DispatcherServlet(applicationContext);
if (refreshContext) {
dispatcherServlet.refresh();
}
dispatcherServlet.onApplicationEvent(new ContextRefreshedEvent(applicationContext));
dispatcherServlet.init(dispatcherConfig);
notifyStartListeners(servletContext);
}
LambdaSpringApplicationInitializer.java 文件源码
java
阅读 17
收藏 0
点赞 0
评论 0
项目:aws-serverless-java-container
作者:
评论列表
文章目录