微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

java.lang.NoClassDefFoundError:org / springframework / boot / context / config / ConfigDataResource

如何解决java.lang.NoClassDefFoundError:org / springframework / boot / context / config / ConfigDataResource

请帮助我运行Spring Boot应用程序。我也在互联网上进行搜索,但一无所获。 当我将其作为Java应用程序运行时,它失败并显示以下消息

[restartedMain] DEBUG org.springframework.boot.context.logging.ClasspathLoggingApplicationListener - Application Failed to start with classpath: [file:/D:.../limits-service/target/classes/]
[restartedMain] ERROR org.springframework.boot.SpringApplication - Application run Failed
java.lang.NoClassDefFoundError: org/springframework/boot/context/config/ConfigDataResource

下面是我的pom.xml

<?xml version="1.0" encoding="UTF-8"?>

4.0.0 org.springframework.boot 弹簧启动启动器父母 2.4.0-M3 com.springboot.microservices 极限服务 0.0.1-快照 极限服务 使用Spring Cloud构建微服务

<properties>
    <java.version>1.8</java.version>
    <spring-cloud.version>2020.0.0-SNAPSHOT</spring-cloud.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-config</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <scope>runtime</scope>
        <optional>true</optional>
    </dependency>
    
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-configuration-processor</artifactId>
        <optional>true</optional>
    </dependency>
</dependencies>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>${spring-cloud.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

<repositories>
    <repository>
        <id>spring-milestones</id>
        <name>Spring Milestones</name>
        <url>https://repo.spring.io/milestone</url>
    </repository>
    <repository>
        <id>spring-snapshots</id>
        <name>Spring Snapshots</name>
        <url>https://repo.spring.io/snapshot</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
</repositories>
<pluginRepositories>
    <pluginRepository>
        <id>spring-milestones</id>
        <name>Spring Milestones</name>
        <url>https://repo.spring.io/milestone</url>
    </pluginRepository>
</pluginRepositories>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。