我想知道为什么设置这个值为1.我读了api,它意味着在这个动态ServletRegistration所代表的Servlet上设置loadOnStartup优先级。为什么是1?为什么Spring-MVC将LoadOnStartup设置为1?
我读一段代码:
public void onStartup(ServletContext servletContext)
throws ServletException {
// TODO Auto-generated method stub
AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
ctx.register(WebAppConfig.class);
servletContext.addListener(new ContextLoaderListener(ctx));
ctx.setServletContext(servletContext);
Dynamic servlet = servletContext.addServlet("dispatcher", new DispatcherServlet(ctx));
servlet.addMapping("/");
servlet.setLoadOnStartup(1);
}