在写SpringAOP demo的时候报了这个错,demo是使用springboot搭建的,但是部分maven依赖复制网上的,导致出现这个问题是因为我的maven依赖引入错误。
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.context.event.EventPublishingRunListener]: Constructor threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.aop.framework.AopProxyUtils.getSingletonTarget(Ljava/lang/Object;)Ljava/lang/Object;
我在网上找的依赖… 很明显这个是spring的,而我的项目是springboot
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>4.0.5.RELEASE</version>
</dependency>
正确的springboot maven依赖为
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
博主在写Spring AOP demo时,因使用Spring Boot搭建项目却复制网上Spring的Maven依赖,导致报错。指出问题是Maven依赖引入错误,并提及需使用正确的Spring Boot Maven依赖。
2221

被折叠的 条评论
为什么被折叠?



