From b594bc4cbb40de47c8d0aa0447193114ef18d96a Mon Sep 17 00:00:00 2001 From: sgibb Date: Mon, 11 Mar 2024 22:44:10 -0400 Subject: [PATCH] Adds property to disable RouteRefreshListener Fixes gh-2958 --- .../cloud/gateway/config/GatewayAutoConfiguration.java | 1 + .../META-INF/additional-spring-configuration-metadata.json | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/spring-cloud-gateway-server/src/main/java/org/springframework/cloud/gateway/config/GatewayAutoConfiguration.java b/spring-cloud-gateway-server/src/main/java/org/springframework/cloud/gateway/config/GatewayAutoConfiguration.java index a567fe8450..118382fa3c 100644 --- a/spring-cloud-gateway-server/src/main/java/org/springframework/cloud/gateway/config/GatewayAutoConfiguration.java +++ b/spring-cloud-gateway-server/src/main/java/org/springframework/cloud/gateway/config/GatewayAutoConfiguration.java @@ -264,6 +264,7 @@ public RouteLocator cachedCompositeRouteLocator(List routeLocators @Bean @ConditionalOnClass(name = "org.springframework.cloud.client.discovery.event.HeartbeatMonitor") + @ConditionalOnProperty(prefix = GatewayProperties.PREFIX, name = ".route-refresh-listener.enabled", matchIfMissing = true) public RouteRefreshListener routeRefreshListener(ApplicationEventPublisher publisher) { return new RouteRefreshListener(publisher); } diff --git a/spring-cloud-gateway-server/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-gateway-server/src/main/resources/META-INF/additional-spring-configuration-metadata.json index d4fc0a5430..58297083b6 100644 --- a/spring-cloud-gateway-server/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/spring-cloud-gateway-server/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -424,6 +424,12 @@ "type": "java.lang.Boolean", "description": "Include the port in matching the host name.", "defaultValue": "true" + }, + { + "name": "spring.cloud.gateway.route-refresh-listener.enabled", + "type": "java.lang.Boolean", + "description": "If RouteRefreshListener should be turned on.", + "defaultValue": "true" } ] }