无法下载/导入包org.springframework.cloud.config.server.EnableConfigServer

2023-12-04

我是 spring-cloud 概念的新手,并且遵循了 spring.io 提供的 spring cloud 文档的每一步

https://spring.io/guides/gs/centralized-configuration/

奇怪的是,当我在 STS 中的 spring-cloud- 上执行 clt+space 时,我没有看到任何在 pom.xml 文件中添加 spring-cloud-starter-config 依赖项的选项,因此我无法导入包org.springframework.cloud.config.server.EnableConfigServer在我的班级文件中。我不明白原因是什么以及为什么会这样。

enter image description here

这是我的配置详细信息:

STS:3.9.0

Maven:3.5.0

Java : 8

编辑1:添加pom.xml文件

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

http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0

<groupId>com.example</groupId>
<artifactId>MicroServices</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>MicroServices</name>
<description>Demo project for Spring Boot</description>

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

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <java.version>1.8</java.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-</artifactId> <!-- Here I don't see option to download spring-cloud-starter-config -->
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>Camden.SR5</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>

如果有人回答我的问题,那将会非常有帮助。


需要导入bom

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>Camden.SR7</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

无法下载/导入包org.springframework.cloud.config.server.EnableConfigServer 的相关文章

随机推荐