Jac*_*cob 4 spring-boot netflix-eureka
我创建了一个 Eureka 服务器 Spring Boot 应用程序。它已正确加载。之后我试图创建一个尤里卡客户端。但它没有在尤里卡服务器 UI 中列出。我正在添加我的客户端应用程序详细信息。
我的主控制器类文件如下,
@SpringBootApplication
@EnableDiscoveryClient
public class ZEurekaClientServiceApplication {
public static void main(String[] args) {
SpringApplication.run(ZEurekaClientServiceApplication.class, args);
}
}
Run Code Online (Sandbox Code Playgroud)
我的 pom.xml 包含 ,
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>
Run Code Online (Sandbox Code Playgroud)
和
<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>
Run Code Online (Sandbox Code Playgroud)
我的 application.properties 文件包含,
eureka.client.serviceUrl.defaultZone=http://localhost:8071/eureka
eureka.client.register-with-eureka=true
eureka.client.fetch-registry=true
Run Code Online (Sandbox Code Playgroud)
当 It 客户端运行时,尤里卡服务器 UI 不显示它的名称。仅将 UNKNOWN 显示为应用程序。我在下面添加它的屏幕截图。
我需要在尤里卡服务器 UI 中显示应用程序名称而不是“UNKNOWN”吗?是否有任何额外的设置来添加应用程序名称?
您可以通过在您的application.yml或在您的application.properties.
对于 application.yml:
spring:
application:
name: {YOUR_APPLICATION_NAME}
Run Code Online (Sandbox Code Playgroud)
对于 application.properties:
spring.application.name={YOUR_APPLICATION_NAME}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3652 次 |
| 最近记录: |