From 8ad15399d65d35ff1559f5e2e7c153909275185d Mon Sep 17 00:00:00 2001 From: Bertrand Renuart Date: Mon, 3 Jul 2017 15:52:01 +0200 Subject: [PATCH] React on ContextClosedEvent only if originating from "our" context (not another like a child) --- .../serviceregistry/EurekaAutoServiceRegistration.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/serviceregistry/EurekaAutoServiceRegistration.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/serviceregistry/EurekaAutoServiceRegistration.java index 96c10033..548e9aac 100644 --- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/serviceregistry/EurekaAutoServiceRegistration.java +++ b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/serviceregistry/EurekaAutoServiceRegistration.java @@ -122,8 +122,9 @@ public class EurekaAutoServiceRegistration implements AutoServiceRegistration, S @EventListener(ContextClosedEvent.class) public void onApplicationEvent(ContextClosedEvent event) { - // register in case meta data changed - stop(); + if( event.getApplicationContext() == context ) { + stop(); + } } }