gpt4 book ai didi

Spring Boot 2.0.0.M1错误由: java. lang.ClassNotFoundException : org. springframework.aop.framework.AopProxyUtils引起

转载 作者:行者123 更新时间:2023-12-02 20:46:26 25 4
gpt4 key购买 nike

我正在尝试新的 Spring-boot 2.0.0.M1。我初始化了项目,只需选择 Web 依赖项,使用 https://start.spring.io/

我在 eclipse 中打开了这个生成的项目,在其上运行 mvn clean install 时遇到以下错误:

    Exception in thread "main" java.lang.IllegalArgumentException: Cannot instantiate interface org.springframework.boot.SpringApplicationRunListener : org.springframework.boot.context.event.EventPublishingRunListener
at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:450)
at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:429)
at org.springframework.boot.SpringApplication.getRunListeners(SpringApplication.java:415)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:323)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1290)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1278)
at com.example.demo.DemoApplication.main(DemoApplication.java:12)
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.context.event.EventPublishingRunListener]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/aop/framework/AopProxyUtils
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:157)
at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:446)
... 6 more
Caused by: java.lang.NoClassDefFoundError: org/springframework/aop/framework/AopProxyUtils
at org.springframework.context.event.AbstractApplicationEventMulticaster.addApplicationListener(AbstractApplicationEventMulticaster.java:104)
at org.springframework.boot.context.event.EventPublishingRunListener.<init>(EventPublishingRunListener.java:55)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:145)
... 7 more
Caused by: java.lang.ClassNotFoundException: org.springframework.aop.framework.AopProxyUtils
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

有人遇到过类似的问题吗?请帮忙。

最佳答案

AutoProxyUtils 类可在 org.springframework.aop.framework.autoproxy 包中使用,而不是在 org.springframework.aop.framework 包中使用。检查类路径中是否有正确版本的 spring-aop 库。不过好像是框架的bug。

我有另一种解决办法,

从启动依赖项中排除 spring-aop

    <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
</exclusion>
</exclusions>
</dependency>

并在新版本中单独添加spring-aop

    <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>5.0.1.RELEASE</version>
</dependency>

关于Spring Boot 2.0.0.M1错误由: java. lang.ClassNotFoundException : org. springframework.aop.framework.AopProxyUtils引起,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44224056/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com