我在开发的时候eureka server(服务注册中心)已经启动完毕,在启动eureka client(客户端)向eureka server(服务注册中心)注册时,client总是自动关闭。
控制台信息如下:
2019-08-08 19:24:07.649 INFO 18912 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2019-08-08 19:24:07.936 INFO 18912 --- [ restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$3e448e19] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.4.RELEASE)
2019-08-08 19:24:09.538 INFO 18912 --- [ restartedMain] c.i.homepage.EurekaClientApplication : No active profile set, falling back to default profiles: default
2019-08-08 19:24:09.987 INFO 18912 --- [ restartedMain] o.s.cloud.context.scope.GenericScope : BeanFactory id=368c9f8e-f8f5-3770-8fd9-80b4463d4e9b
2019-08-08 19:24:10.043 INFO 18912 --- [ restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$3e448e19] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-08-08 19:24:10.058 WARN 18912 --- [ restartedMain] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources.
2019-08-08 19:24:10.058 INFO 18912 --- [ restartedMain] c.n.c.sources.URLConfigurationSource : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2019-08-08 19:24:10.064 WARN 18912 --- [ restartedMain] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources.
2019-08-08 19:24:10.064 INFO 18912 --- [ restartedMain] c.n.c.sources.URLConfigurationSource : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2019-08-08 19:24:10.249 INFO 18912 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2019-08-08 19:24:13.353 INFO 18912 --- [ restartedMain] o.s.c.n.eureka.InstanceInfoFactory : Setting initial instance status as: STARTING
2019-08-08 19:24:13.390 INFO 18912 --- [ restartedMain] com.netflix.discovery.DiscoveryClient : Initializing Eureka in region us-east-1
2019-08-08 19:24:14.703 INFO 18912 --- [ restartedMain] c.n.d.provider.DiscoveryJerseyProvider : Using JSON encoding codec LegacyJacksonJson
2019-08-08 19:24:14.703 INFO 18912 --- [ restartedMain] c.n.d.provider.DiscoveryJerseyProvider : Using JSON decoding codec LegacyJacksonJson
2019-08-08 19:24:14.837 INFO 18912 --- [ restartedMain] c.n.d.provider.DiscoveryJerseyProvider : Using XML encoding codec XStreamXml
2019-08-08 19:24:14.837 INFO 18912 --- [ restartedMain] c.n.d.provider.DiscoveryJerseyProvider : Using XML decoding codec XStreamXml
2019-08-08 19:24:15.040 INFO 18912 --- [ restartedMain] c.n.d.s.r.aws.ConfigClusterResolver : Resolving eureka endpoints via configuration
2019-08-08 19:24:16.033 INFO 18912 --- [ restartedMain] com.netflix.discovery.DiscoveryClient : Disable delta property : false
2019-08-08 19:24:16.033 INFO 18912 --- [ restartedMain] com.netflix.discovery.DiscoveryClient : Single vip registry refresh property : null
2019-08-08 19:24:16.033 INFO 18912 --- [ restartedMain] com.netflix.discovery.DiscoveryClient : Force full registry fetch : false
2019-08-08 19:24:16.033 INFO 18912 --- [ restartedMain] com.netflix.discovery.DiscoveryClient : Application is null : false
2019-08-08 19:24:16.033 INFO 18912 --- [ restartedMain] com.netflix.discovery.DiscoveryClient : Registered Applications size is zero : true
2019-08-08 19:24:16.033 INFO 18912 --- [ restartedMain] com.netflix.discovery.DiscoveryClient : Application version is -1: true
2019-08-08 19:24:16.033 INFO 18912 --- [ restartedMain] com.netflix.discovery.DiscoveryClient : Getting all instance registry info from the eureka server
2019-08-08 19:24:16.245 INFO 18912 --- [ restartedMain] com.netflix.discovery.DiscoveryClient : The response status is 200
2019-08-08 19:24:16.249 INFO 18912 --- [ restartedMain] com.netflix.discovery.DiscoveryClient : Starting heartbeat executor: renew interval is: 30
2019-08-08 19:24:16.252 INFO 18912 --- [ restartedMain] c.n.discovery.InstanceInfoReplicator : InstanceInfoReplicator onDemand update allowed rate per min is 4
2019-08-08 19:24:16.258 INFO 18912 --- [ restartedMain] com.netflix.discovery.DiscoveryClient : Discovery Client initialized at timestamp 1565263456257 with initial instances count: 1
2019-08-08 19:24:16.259 INFO 18912 --- [ restartedMain] o.s.c.n.e.s.EurekaServiceRegistry : Registering application HOMEPAGE-EUREKA-CLIENT with eureka with status UP
2019-08-08 19:24:16.259 INFO 18912 --- [ restartedMain] com.netflix.discovery.DiscoveryClient : Saw local status change event StatusChangeEvent [timestamp=1565263456259, current=UP, previous=STARTING]
2019-08-08 19:24:16.262 INFO 18912 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_HOMEPAGE-EUREKA-CLIENT/DESKTOP-IHJGNUQ:homepage-eureka-client:8100: registering service...
2019-08-08 19:24:16.281 INFO 18912 --- [ restartedMain] c.i.homepage.EurekaClientApplication : Started EurekaClientApplication in 10.766 seconds (JVM running for 12.922)
2019-08-08 19:24:16.288 INFO 18912 --- [ Thread-33] o.s.c.n.e.s.EurekaServiceRegistry : Unregistering application HOMEPAGE-EUREKA-CLIENT with eureka with status DOWN
2019-08-08 19:24:16.289 WARN 18912 --- [ Thread-33] com.netflix.discovery.DiscoveryClient : Saw local status change event StatusChangeEvent [timestamp=1565263456289, current=DOWN, previous=UP]
2019-08-08 19:24:16.297 INFO 18912 --- [ Thread-33] com.netflix.discovery.DiscoveryClient : Shutting down DiscoveryClient ...
2019-08-08 19:24:16.315 INFO 18912 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_HOMEPAGE-EUREKA-CLIENT/DESKTOP-IHJGNUQ:homepage-eureka-client:8100 - registration status: 204
2019-08-08 19:24:16.315 INFO 18912 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_HOMEPAGE-EUREKA-CLIENT/DESKTOP-IHJGNUQ:homepage-eureka-client:8100: registering service...
2019-08-08 19:24:16.321 INFO 18912 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_HOMEPAGE-EUREKA-CLIENT/DESKTOP-IHJGNUQ:homepage-eureka-client:8100 - registration status: 204
2019-08-08 19:24:16.321 INFO 18912 --- [ Thread-33] com.netflix.discovery.DiscoveryClient : Unregistering ...
2019-08-08 19:24:16.328 INFO 18912 --- [ Thread-33] com.netflix.discovery.DiscoveryClient : DiscoveryClient_HOMEPAGE-EUREKA-CLIENT/DESKTOP-IHJGNUQ:homepage-eureka-client:8100 - deregister status: 200
2019-08-08 19:24:16.338 INFO 18912 --- [ Thread-33] com.netflix.discovery.DiscoveryClient : Completed shut down of DiscoveryClient
Process finished with exit code 0
我也没看懂什么原因,就在网上搜了一下
在一个博主的博文中看到说是要添加web的依赖,我添加后确实解决了该问题,该博主也解释了添加的原因
但是我的输出信息感觉缺少了好多,博主提到的那个信息我这里并没有找到,不知道是什么原因导致缺少了很多有用信息
下面我也附上了博主的博文链接,大家可以去看一下,学习学习
解决方法原博文链接:https://blog.youkuaiyun.com/CodeFarmer_/article/details/80592388
解决方法:
在pom.xml中加入
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
即可