java.lang.NoClassDefFoundError: org/springframework/core/env/ConfigurableEnvironment

后端 未结 7 1448
孤独总比滥情好
孤独总比滥情好 2020-11-27 08:03

I am trying to write a simple RESTful service using Spring Boot. However, there is an error message I am not able to solve. I have been researching and it looks like it is a

相关标签:
7条回答
  • 2020-11-27 08:21

    Delete the springframework folder in repository, then press Alt + F5 and update the project (force update snapshot).

    C:\Users\xxxx\.m2\repository\org\springframework
    
    0 讨论(0)
  • 2020-11-27 08:22

    I changed the boot-starter-parent configuration which was runnig version 2.0.0 to 1.4.0 and I was able to run the java application and got rid of this error

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.4.0.RELEASE</version>  <!-- changed it to version 1.4.0 from 2.0.0-->
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    
    0 讨论(0)
  • 2020-11-27 08:31

    changed the boot-starter-parent version from 1.5.1.RELEASE to 1.4.0.RELEASE.

    0 讨论(0)
  • 2020-11-27 08:31
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.4.2.RELEASE</version>
      </parent>
    

    Please Try this one for your parent

    0 讨论(0)
  • 2020-11-27 08:31

    I had same problem with Spring boot 2.1.9.RELEASE

        <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>2.1.9.RELEASE</version>
            <relativePath/> <!-- lookup parent from repository -->
        </parent>
    

    Added pom dependency eliminated this exception:

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>5.2.0.RELEASE</version>
        </dependency>
    

    EDIT - better approach.

    Also clean up of maven repository with spring dependencies resolved problem for me, there were not need to add spring-core 5.2.0.RELEASE in pom. Seems that when I had many versions of spring in repo some problem occurs. Also before again resolve dependencies dont forget clean project.

    rm -rf ~/.m2/repository/org/springframework/
    
    0 讨论(0)
  • 2020-11-27 08:35

    Spring boot is running -

    <spring.version>4.3.2.RELEASE</spring.version>
    

    For -

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <version>1.4.0.RELEASE</version>
        </dependency>
    

    While you are importing -

        <springframework.version>4.3.0.RELEASE</springframework.version>
    

    You can confirm on the master pom -

    https://github.com/spring-projects/spring-boot/blob/v1.4.0.RELEASE/spring-boot-dependencies/pom.xml

    Can you update the spring version in your pom? Or deal with managing maven dependencies

    0 讨论(0)
提交回复
热议问题