gpt4 book ai didi

spring - ClassNotFoundException : org. springframework.hateoas.Resource 即使我添加了依赖项

转载 作者:行者123 更新时间:2023-12-03 23:12:34 24 4
gpt4 key购买 nike

我的 pom.xml 中有以下内容

<dependency>
<groupId>org.springframework.hateoas</groupId>
<artifactId>spring-hateoas</artifactId>
</dependency>

但我仍然收到以下消息
Caused by: java.lang.NoClassDefFoundError: org/springframework/hateoas/Resource
at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.8.0_191]
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) ~[na:1.8.0_191]
at java.lang.Class.getDeclaredMethods(Class.java:1975) ~[na:1.8.0_191]
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:668) ~[spring-core-5.1.5.RELEASE.jar:5.1.5.RELEASE]
... 21 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.springframework.hateoas.Resource
at java.net.URLClassLoader.findClass(URLClassLoader.java:382) ~[na:1.8.0_191]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_191]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) ~[na:1.8.0_191]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_191]
... 25 common frames omitted

我尝试删除 .m2 的内容文件夹并再次下载所有依赖项。我尝试强制更新 maven 项目,但在启动 Spring Boot 项目时仍然收到消息。任何人都知道为什么即使我添加了依赖项也会得到这个?

最佳答案

对于 Spring Boot 使用 spring-boot-starter-hateoas依赖

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-hateoas</artifactId>
<version>2.1.4.RELEASE</version>
</dependency>

关于spring - ClassNotFoundException : org. springframework.hateoas.Resource 即使我添加了依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56015805/

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