Recheck for null service instance to avoid micrometer NPE. (#1197)

This commit is contained in:
Olga Maciaszek-Sharma
2023-01-18 11:57:41 +01:00
committed by GitHub
parent 483798a7d2
commit a4a37cd975
3 changed files with 10 additions and 0 deletions

View File

@@ -105,6 +105,9 @@ public class BlockingLoadBalancerClient implements LoadBalancerClient {
@Override
public <T> T execute(String serviceId, ServiceInstance serviceInstance, LoadBalancerRequest<T> request)
throws IOException {
if (serviceInstance == null) {
throw new IllegalArgumentException("Service Instance cannot be null");
}
DefaultResponse defaultResponse = new DefaultResponse(serviceInstance);
Set<LoadBalancerLifecycle> supportedLifecycleProcessors = getSupportedLifecycleProcessors(serviceId);
Request lbRequest = request instanceof Request ? (Request) request : new DefaultRequest<>();

View File

@@ -33,6 +33,12 @@
"name": "spring.cloud.loadbalancer.enabled",
"description": "Enables Spring Cloud LoadBalancer.",
"type": "java.lang.Boolean"
},
{
"defaultValue": "false",
"name": "spring.cloud.loadbalancer.stats.micrometer.enabled",
"description": "Enables Spring Cloud LoadBalancer Micrometer stats.",
"type": "java.lang.Boolean"
}
]
}