使用spring整合Junit专用的类加载器
#pom.xml中引入
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>5.3.21</version>
<scope>test</scope>
</dependency>
注意:spring-test的版本应和 spring-context保持一致,否则会报以下错误:
java.lang.IllegalStateException: Could not load TestContextBootstrapper [null]. Specify @BootstrapWi......