我在 Spring Cloud Eureka Server(端口 8761)下运行的端口 10351(localhost:10351 ... testing)上有服务“usermanagement”,应用程序注册良好,我可以在 Eureka 仪表板上看到它
当我发出 POST 以刷新该应用程序 bean 时,应用程序会从 Eureka Server 注销并且永远不会重新注册。
发布 http://localhost:10351/ refresh
如何在 /refresh 之后重新注册应用程序?
这是我发出 POST 后的日志:
o.a.c.c.C.[Tomcat].[localhost].[/] --- Initializing Spring FrameworkServlet 'dispatcherServlet'
o.s.web.servlet.DispatcherServlet --- FrameworkServlet 'dispatcherServlet': initialization started
o.s.web.servlet.DispatcherServlet --- FrameworkServlet 'dispatcherServlet': initialization completed in 40 ms
o.s.boot.SpringApplication --- Starting application on TUSFL000LKVT4TN with PID 19212 (C:\Users\nickb\.m2\repository\org\springframework\boot\spring-boot\1.2.5.RELEASE\spring-boot-1.2.5.RELEASE.jar started by v227873 in C:\uiam\workspace\uiam.git2\commonservices\usermanagement-cloud)
o.s.c.a.AnnotationConfigApplicationContext --- Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@536f88ca: startup date [Wed Aug 26 11:03:50 EDT 2015]; root of context hierarchy
o.s.b.f.a.AutowiredAnnotationBeanPostProcessor --- JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker --- Bean 'encrypt.CONFIGURATION_PROPERTIES' of type [class org.springframework.cloud.bootstrap.encrypt.KeyProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker --- Bean 'encryptionBootstrapConfiguration' of type [class org.springframework.cloud.bootstrap.encrypt.EncryptionBootstrapConfiguration$$EnhancerBySpringCGLIB$$a4525514] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
o.s.c.s.DefaultLifecycleProcessor --- Starting beans in phase 0
o.s.c.n.e.EurekaDiscoveryClientConfiguration --- Registering application usermanagement with eureka with status UP
o.s.c.n.c.DiscoveryClientConfigServiceBootstrapConfiguration --- Locating configserver via discovery
o.s.boot.SpringApplication --- Started application in 0.305 seconds (JVM running for 124.036)
o.s.c.b.c.PropertySourceBootstrapConfiguration --- Located property source: CompositePropertySource [name='configService', propertySources=[MapPropertySource [name='link_to_mycompany_git/scm/uiam/service-config-store.git/usermanagement.yml#development'], MapPropertySource [name='link_to_mycompany_git/scm/uiam/service-config-store.git/usermanagement.yml']]]
o.s.c.a.AnnotationConfigApplicationContext --- Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@2be8f1c7: startup date [Wed Aug 26 11:03:52 EDT 2015]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@536f88ca
o.s.b.f.a.AutowiredAnnotationBeanPostProcessor --- JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
o.s.c.n.c.DiscoveryClientConfigServiceBootstrapConfiguration --- Locating configserver via discovery
o.s.boot.SpringApplication --- Started application in 1.543 seconds (JVM running for 125.24)
o.s.c.a.AnnotationConfigApplicationContext --- Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@2be8f1c7: startup date [Wed Aug 26 11:03:52 EDT 2015]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@536f88ca
o.s.c.a.AnnotationConfigApplicationContext --- Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@536f88ca: startup date [Wed Aug 26 11:03:50 EDT 2015]; root of context hierarchy
o.s.c.s.DefaultLifecycleProcessor --- Stopping beans in phase 0
o.s.c.n.e.EurekaDiscoveryClientConfiguration --- Unregistering application usermanagement with eureka with status DOWN
o.s.c.n.e.EurekaDiscoveryClientConfiguration --- Closing DiscoveryClient.jerseyClient
o.s.c.n.e.EurekaDiscoveryClientConfiguration --- Removing application usermanagement from eureka
c.netflix.discovery.DiscoveryClient --- DiscoveryClient_USERMANAGEMENT/TUSFL000LKVT4TN:usermanagement:10351:0579e19a2d4e3e88d60686eb208d180a - deregister status: 200
看到最后一行了吗?DiscoveryClient --- DiscoveryClient_USERMANAGEMENT/TUSFL000LKVT4TN:usermanagement:10351:0579e19a2d4e3e88d60686eb208d180a - 注销状态:200
在那之后 - 什么都没有
我正在使用这个版本的 Spring cloud
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter</artifactId>
<version>1.0.3.RELEASE</version>
</dependency>
如果重要的话,我的应用程序本身没有 application.yml,但我从我们公司的 GIT 中获取它。它包含 DB 数据源参数