Caused by: java.lang.ClassNotFoundException: org.springframework.core.annotation.MergedAnnotations

刚碰到一个错,如题,在 Springboot 中使用测试类,依赖以下报如上错

<dependency>
     <groupId>org.springframework</groupId>
     <artifactId>spring-test</artifactId>
     <version>5.2.6.RELEASE</version>
     <scope>compile</scope>
</dependency>

<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
</dependency>

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-test</artifactId>
</dependency>

这是因为依赖重复,只要依赖如下就行

<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.12</version>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-test</artifactId>
</dependency>

本文由老郭种树原创,转载请注明:https://guozh.net/caused-by-java-lang-classnotfoundexception-org-springframework-core-annotation-mergedannotations/

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注