Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/349.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Eureka服务器未显示configserver micro服务-为什么?_Java_Spring Boot_Netflix Eureka_Configserver - Fatal编程技术网

Java Eureka服务器未显示configserver micro服务-为什么?

Java Eureka服务器未显示configserver micro服务-为什么?,java,spring-boot,netflix-eureka,configserver,Java,Spring Boot,Netflix Eureka,Configserver,我已经创建了一个配置服务器并在其上启用了discovery client,但我的问题是在我的eureka服务器GUI上,它没有显示在“应用程序”选项卡下 我的代码是: @EnableEurekaServer @SpringBootApplication public class EurekaServerApplication { public static void main(String[] args) { SpringApplication.run(EurekaSe

我已经创建了一个配置服务器并在其上启用了discovery client,但我的问题是在我的eureka服务器GUI上,它没有显示在“应用程序”选项卡下

我的代码是:

@EnableEurekaServer
@SpringBootApplication
public class EurekaServerApplication {

    public static void main(String[] args) {
        SpringApplication.run(EurekaServerApplication.class, args);
    }
}
Application.yml

server:
  port: 8761

eureka:
  instance:
    hostname: discovery
  client:
    registerWithEureka: false
    fetchRegistry: false
    serviceUrl:
      defaultZone: http://discovery:${server.port}/eureka/

spring.cloud.config.discovery.enabled: true
server:
  port: 8888

eureka:
  instance:
    hostname: configserver
  client:
    registerWithEureka: true
    fetchRegistry: true
    serviceUrl:
      defaultZone: http://discovery:8761/eureka/

spring:
  cloud:
    config:
      server:
        git:
          uri: https://github.com/kbastani/spring-boot-microservice-config
将服务器配置为eureka客户端

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

server:
  port: 8761

eureka:
  instance:
    hostname: discovery
  client:
    registerWithEureka: false
    fetchRegistry: false
    serviceUrl:
      defaultZone: http://discovery:${server.port}/eureka/

spring.cloud.config.discovery.enabled: true
server:
  port: 8888

eureka:
  instance:
    hostname: configserver
  client:
    registerWithEureka: true
    fetchRegistry: true
    serviceUrl:
      defaultZone: http://discovery:8761/eureka/

spring:
  cloud:
    config:
      server:
        git:
          uri: https://github.com/kbastani/spring-boot-microservice-config
在先运行Eureka服务器,然后运行config server之后,一切正常,没有异常,但在“实例”选项卡下未列出任何应用程序,请查看下面的屏幕截图:


有人能帮我理解这一点吗?

服务发现客户端是使用“spring.application.name”注册的,您有定义吗?是的,在bootstrap.yml中,我有定义,但在application.yml中没有。yml这台机器有多个网络接口吗?我不确定这一点?你能解释一下吗?我正在学习。首先,您需要在同一台主机上以“主机名”作为“本地主机”运行Discovery客户端和服务器,并查看它是否有效。