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>
怎么说呢?不管有用没,还是想加上这句
老郭种树原创,转载请加上Caused by: java.lang.ClassNotFoundException: org.springframework.core.annotation.MergedAnnotations
点赞

发表评论

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