情形:Spring 监听器加载applicationContext.xml
public void contextInitialized(ServletContextEvent servletContextEvent) {
System.out.println("ServletContextListener");
final ServletContext servletContext = servletContextEvent.getServletContext();
final String contextLocation = servletContext.getInitParameter("contextLocation");
// 初始化加载 applicationContext
final String substring = contextLocation.substring("classpath:".length());
ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");
servletContext.setAttribute("applicationContext", applicationContext);
}
异常如下:
错误:Caused by: java.lang.NoSuchMethodError: org.springframework.aop.config.AopNamespaceUtils.registerAutoProxyCreatorIfNecessary(Lorg/springframework/beans/factory/xml/ParserContext;Ljava/lang/Object;)V
有图有真相