spring-core 不支持
The following method did not exist:
'void org.springframework.util.Assert.notNull(java.lang.Object)'
The calling method's class, org.springframework.plugin.core.support.AbstractTypeAwareSupport$BeansOfTypeTargetSource, was loaded from the following location:
jar:file:/E:/apache-maven-3.8.5/mvn-repo/org/springframework/plugin/spring-plugin-core/1.2.0.RELEASE/spring-plugin-core-1.2.0.RELEASE.jar!/org/springframework/plugin/core/support/AbstractTypeAwareSupport$BeansOfTypeTargetSource.class
The called method's class, org.springframework.util.Assert, is available from the following locations:
jar:file:/E:/apache-maven-3.8.5/mvn-repo/org/springframework/spring-core/6.1.3/spring-core-6.1.3.jar!/org/springframework/util/Assert.class
The called method's class hierarchy was loaded from the following locations:
org.springframework.util.Assert: file:/E:/apache-maven-3.8.5/mvn-repo/org/springframework/spring-core/6.1.3/spring-core-6.1.3.jar
上面的意思就是出现了依赖冲突,首先就是要定位是引入的哪一个包出现冲突,这里就是org.springframework.boot:spring-boot-starter-test:3.2.2 :
原因就在于我们升级了Spring3.x,但测试的时候还是依赖的旧的Spring-core就导致不兼容,查看网上有用exclusion排除spring-core的依赖,参考下面教程一样:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>org.springframework.plugin</artifactId>
<groupId>spring-plugin-core</groupId>
</exclusion>
</exclusions>
</dependency>
但实际上还是报错,最后常用升级依赖进行解决
在pom文件中升级依赖:
<dependency>
<groupId>org.springframework.plugin</groupId>
<artifactId>spring-plugin-core</artifactId>
<version>3.0.0</version>
</dependency>