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

后端 未结 7 1537
孤独总比滥情好
孤独总比滥情好 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:36

    Recommended Approach

    1. Go to Spring boot Initialzr site and select web stack as a dependency as shown in below .
    2. As Spring Boot uses the concept of Opinionated dependencies and Bill of Materials, It will automatically pull the other dependencies and resolve your classNotFoundException issue. And in your case it misses out the Spring-core-4.2.4.RELEASE.jar dependency.
    3. Execute the Maven Goal as clean install spring-boot:run -e and you can find your maven dependencies in your IDE and below given is a sample POM file.

        
       
          4.0.0
      
         com.example
        demo
       0.0.1-SNAPSHOT
       war
      
           demo
          Demo project for Spring Boot
      
           
             org.springframework.boot
            spring-boot-starter-parent
           1.4.0.RELEASE
            
         
      
          
            UTF-8
             UTF-       8
          1.8
          
      
       
           
             org.springframework.boot
              spring-boot-starter-web
           
      
           
                org.springframework.boot
                  spring-boot-starter-tomcat
                   provided
            
          
          org.springframework.boot
          spring-boot-starter-actuator
           
           
              org.springframework.boot
              spring-boot-starter-test
              test
            < /dependency>
          
      
        
          demo
             
               
                  org.springframework.boot
                  spring-boot-maven-plugin
               
            
          
      

提交回复
热议问题