如果我开始测试,我就会得到这样的例外:
java.lang.IllegalAccessError: tried to access method org.springframework.core.convert.support.DefaultConversionService.addCollectionConverters(Lorg/springframework/core/convert/converter/ConverterRegistry;)V from class org.springframework.boot.bind.RelaxedConversionService这些是我的依赖:

有没有人知道我能做些什么来运行我的Junit测试。该应用程序在生产上运行良好,但我的测试使用了spring 1.3.8.RELEASE和Spring4.2.5.RELEASE。
这些是我的POM文件中的依赖项:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>smartinnotec-legalprojectmanagement-dao</artifactId>
<packaging>jar</packaging>
<name>smartinnotec-legalprojectmanagement-dao</name>
<url>http://maven.apache.org</url>
<parent>
<groupId>com.smartinnotec.legalprojectmanagement</groupId>
<artifactId>smartinnotec-legalprojectmanagement-main</artifactId>
<version>1.0.1-SNAPSHOT</version>
<relativePath>../smartinnotec-legalprojectmanagement-main/pom.xml</relativePath>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.smartinnotec.legalprojectmanagement</groupId>
<artifactId>smartinnotec-legalprojectmanagement-core</artifactId>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>发布于 2018-04-10 10:27:14
您不能在Spring 1.3.8中使用SpringFramework4.2.5。作为在文档中描述,SpringBoot1.3.8需要SpringFramework4.2.8或更高版本。
您需要对pom进行一些更改,以便使用4.2.8。这应该和允许Spring的依赖关系管理来控制Spring版本一样简单。我不能确切地说出需要做什么改变,因为你的问题中的内容是不完整的。
https://stackoverflow.com/questions/49750445
复制相似问题