刚碰到一个错,如题,在 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/