From 88662b6708f2a1ecae27603f49d9a6caba2be7c8 Mon Sep 17 00:00:00 2001 From: sgibb Date: Tue, 19 Dec 2023 16:59:00 -0500 Subject: [PATCH] Suppress NoClassDefFoundError on AbstractGatewayDiscoverer --- .../server/mvc/common/AbstractGatewayDiscoverer.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/spring-cloud-gateway-server-mvc/src/main/java/org/springframework/cloud/gateway/server/mvc/common/AbstractGatewayDiscoverer.java b/spring-cloud-gateway-server-mvc/src/main/java/org/springframework/cloud/gateway/server/mvc/common/AbstractGatewayDiscoverer.java index f72ab2a87a..3a04733553 100644 --- a/spring-cloud-gateway-server-mvc/src/main/java/org/springframework/cloud/gateway/server/mvc/common/AbstractGatewayDiscoverer.java +++ b/spring-cloud-gateway-server-mvc/src/main/java/org/springframework/cloud/gateway/server/mvc/common/AbstractGatewayDiscoverer.java @@ -43,7 +43,16 @@ public >, R> void doDiscover(Class supp List methods = new ArrayList<>(); for (Supplier> supplier : suppliers) { - methods.addAll(supplier.get()); + try { + methods.addAll(supplier.get()); + } + catch (NoClassDefFoundError e) { + if (log.isDebugEnabled()) { + log.debug(LogMessage.format("NoClassDefFoundError discovering supplier %s for type %s", supplierClass, returnType)); + } else if (log.isTraceEnabled()) { + log.debug(LogMessage.format("NoClassDefFoundError discovering supplier %s for type %s", supplierClass, returnType), e); + } + } } for (Method method : methods) {