报错如下:
DiscoveryClient_USER-CENTER/192.168.1.231:user-center:2001: registering service...
Started UserCenterApplication in 2.351 seconds (JVM running for 2.892)
Unregistering application USER-CENTER with eureka with status DOWN
Saw local status change event StatusChangeEvent [timestamp=1583640516889, current=DOWN, previous=UP]
Shutting down DiscoveryClient ...
DiscoveryClient_USER-CENTER/192.168.1.231:user-center:2001 - registration status: 204
DiscoveryClient_USER-CENTER/192.168.1.231:user-center:2001: registering service...
DiscoveryClient_USER-CENTER/192.168.1.231:user-center:2001 - registration status: 204
Unregistering ...
DiscoveryClient_USER-CENTER/192.168.1.231:user-center:2001 - deregister status: 200
Completed shut down of DiscoveryClient
springboot版本:2.2.0.RELEASE
springcloud版本:Hoxton.RELEASE
解决:
在eureka-client中加入web包后解决
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
可能原因:
1.不用web包只是一个java程序,所以运行后就停止了;
2.spring-boot-starter-web这个包里面存在tomcat,boot运行都需要这个包
以上猜测来自网络。