Spring经典异常Caused by: java.lang.NoSuchMethodError: org.springframework.aop.config.AopNamespaceUtils

本文描述了在使用Spring监听器加载applicationContext.xml时遇到的`NoSuchMethodError`异常,主要问题在于SpringDAO的冲突。作者通过移除`spring-dao`模块解决了这个问题。
摘要由CSDN通过智能技术生成

情形: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
有图有真相
在这里插入图片描述

问题核心所在:冲突

在这里插入图片描述

解决: 直接干掉了 spring-dao

  • 10
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值