Eureka的客户端无法正常启动
eureka客户端启动后即被shutdown了,控制台无报错问题的解决方案:
方案一: 配置文件有错误,修改配置文件
client:
server:
port: 7711
spring:
application:
name: product-server
eureka:
client:
serviceUrl:
defaultZone: http://127.0.0.1:6611/eureka
server:
server:
port: 6611
spring:
application:
name: eureka-server
eureka:
instance:
hostname: 127.0.0.1
client:
# 将自己注册到注册中心,设置为false,如果是集群,则要设置为true
register-with-eureka: false
fetch-registry: false
serviceUrl:
defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka
方案二 : 在pom.xml文件中导入spring-boot-starter-web的启动依赖。
client:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
server:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
这样就可以正常启动并注册服务了。。。。