spring boot版本1.3.8.RELEASE和Spring 4.2.5.RELEASE - > IllegalAccessError

时间:2018-04-10 09:46:13

标签: spring spring-boot

如果我开始测试,我会遇到这个例外:

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

这些是我的依赖项:

my dependencies

有谁知道我可以做什么来运行我的Junit测试。 该应用程序在生产效率方面运行良好,但我的测试因春季启动版本1.3.8.RELEASE和Spring 4.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>

1 个答案:

答案 0 :(得分:0)

您不能将Spring Framework 4.2.5与Spring Boot 1.3.8一起使用。作为described in the documentation,Spring Boot 1.3.8需要Spring Framework 4.2.8或更高版本。

您需要对pom进行一些更改,以便使用4.2.8。这应该像允许Spring Boot的依赖管理来控制Spring Framework的版本一样简单。由于你问题中的pom不完整,我无法确切地说出需要做出哪些改变。

相关问题