From af9375440d886e97e8b7512e086d4715e47e4f7d Mon Sep 17 00:00:00 2001 From: "jianghang.loujh" Date: Wed, 6 Aug 2025 10:18:37 +0800 Subject: [PATCH] fixed empty config --- .../spring/support/PropertyPlaceholderConfigurer.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/instance/spring/src/main/java/com/alibaba/otter/canal/instance/spring/support/PropertyPlaceholderConfigurer.java b/instance/spring/src/main/java/com/alibaba/otter/canal/instance/spring/support/PropertyPlaceholderConfigurer.java index 80b0ae31..7700b902 100644 --- a/instance/spring/src/main/java/com/alibaba/otter/canal/instance/spring/support/PropertyPlaceholderConfigurer.java +++ b/instance/spring/src/main/java/com/alibaba/otter/canal/instance/spring/support/PropertyPlaceholderConfigurer.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Properties; +import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.InitializingBean; import org.springframework.context.ResourceLoaderAware; import org.springframework.core.io.Resource; @@ -126,20 +127,20 @@ public class PropertyPlaceholderConfigurer extends org.springframework.beans.fac } // 以threadlocal的为准覆盖file properties - if (propVal == null) { + if (StringUtils.isBlank(propVal)) { Properties localProperties = propertiesLocal.get(); propVal = resolvePlaceholder(dp.placeholder, localProperties); } - if (propVal == null) { + if (StringUtils.isBlank(propVal)) { propVal = resolvePlaceholder(dp.placeholder, props); } - if (propVal == null && systemPropertiesMode == SYSTEM_PROPERTIES_MODE_FALLBACK) { + if (StringUtils.isBlank(propVal) && systemPropertiesMode == SYSTEM_PROPERTIES_MODE_FALLBACK) { propVal = resolveSystemProperty(dp.placeholder); } - if (propVal == null) { + if (StringUtils.isBlank(propVal)) { propVal = dp.defaultValue; }