我一直不太明白,在initWebApplicationContext方法的第一行,
if (servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE) != null) {
throw new IllegalStateException(
"Cannot initialize context because there is already a root application context present - " +
"check whether you have multiple ContextLoader* definitions in your web.xml!");
}
请问各位大佬,难道servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE) 何时不等于null呢??为什么要判断一下不等于null呢?服务刚启动的时候,还有不等于null的时候吗?之前学习servlet的时候并没有太认真学,还请各位大神帮忙解释一下,在此感谢