gpt4 book ai didi

java - import de.codecentric.boot.admin.server.config.EnableAdminServer无法解析

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:07:34 24 4
gpt4 key购买 nike

我正在引用 https://github.com/spring-petclinic/spring-petclinic-microservices 开发微服务代码.我能够成功运行所有模块,但出现以下错误。

The import de.codecentric.boot.admin.server.config.EnableAdminServer cannot be resolved

spring-petclinic-admin-server 模块中,我收到以下错误。

import de.codecentric.boot.admin.server.config.EnableAdminServer;

@Configuration
@EnableAutoConfiguration
@EnableAdminServer
@EnableDiscoveryClient
public class SpringBootAdminApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBootAdminApplication.class, args);
}
}

enter image description here

我能够启动其他微服务模块。

enter image description here

pom.xml

<parent>
<groupId>org.springframework.samples</groupId>
<artifactId>spring-petclinic-microservices</artifactId>
<version>2.0.4</version>
</parent>

<properties>
<spring-boot-admin.version>2.0.1</spring-boot-admin.version>
<docker.image.exposed.port>9090</docker.image.exposed.port>
<docker.image.dockerfile.dir>${basedir}/../docker</docker.image.dockerfile.dir>
</properties>

<dependencies>
<!-- Spring Boot -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>

<!-- Spring Boot Admin -->
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-server</artifactId>
<version>${spring-boot-admin.version}</version>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server-ui</artifactId>
<version>${spring-boot-admin.version}</version>
</dependency>

<!-- Third-party librairies -->
<dependency>
<groupId>org.jolokia</groupId>
<artifactId>jolokia-core</artifactId>
</dependency>

</dependencies>

最佳答案

根据链接:https://codecentric.github.io/spring-boot-admin/current/ .我添加了以下依赖项,然后它运行良好。

<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-server</artifactId>
<version>2.1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

关于java - import de.codecentric.boot.admin.server.config.EnableAdminServer无法解析,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52460433/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com