java.lang.NoSuchMethodError: org.springframework.util.Assert.notNull(Ljava/lang/Object;Ljava/util/function/Supplier;)V

分析,jar包冲突,然后看pom.xml文件

原因在于jar包冲突,版本不兼容,

错误的代码:  可以看到有很多不同版本的重复的spring-test依赖

      <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-test</artifactId>
          <version>5.0.6.RELEASE</version>
          <scope>test</scope>
      </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-test</artifactId>
      <version>${spring.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-test</artifactId>
      <version>4.3.6.RELEASE</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-test</artifactId>
      <version>5.0.4.RELEASE</version>
      <scope>test</scope>
    </dependency>

解决方法:  只保留和SpringFramework版本相同的Spring-test的依赖

    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-test</artifactId>
      <version>${spring.version}</version>
      <scope>test</scope>
    </dependency>
   

问题解决!

posted @ 2019-06-26 11:10  何茫然zju  阅读(9509)  评论(0编辑  收藏  举报