Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix spring spi extension keeps printing warn log during starting. #6144

Merged
merged 6 commits into from Jun 8, 2021
Merged
Expand Up @@ -102,9 +102,7 @@ public static String getProperty(String property, String defaultValue) {

public static Map<String, String> parseProperties(String content) throws IOException {
Map<String, String> map = new HashMap<>();
if (StringUtils.isEmpty(content)) {
logger.warn("You specified the config center, but there's not even one single config item in it.");
} else {
if (StringUtils.isNotEmpty(content)) {
Properties properties = new Properties();
properties.load(new StringReader(content));
properties.stringPropertyNames().forEach(
Expand Down
Expand Up @@ -18,6 +18,7 @@

import org.apache.dubbo.common.context.FrameworkExt;
import org.apache.dubbo.common.context.LifecycleAdapter;
import org.apache.dubbo.common.extension.DisableInject;
import org.apache.dubbo.common.logger.Logger;
import org.apache.dubbo.common.logger.LoggerFactory;
import org.apache.dubbo.common.utils.CollectionUtils;
Expand Down Expand Up @@ -75,7 +76,7 @@ public ConfigManager() {
}

// ApplicationConfig correlative methods

@DisableInject
public void setApplication(ApplicationConfig application) {
addConfig(application, true);
}
Expand All @@ -90,6 +91,7 @@ public ApplicationConfig getApplicationOrElseThrow() {

// MonitorConfig correlative methods

@DisableInject
public void setMonitor(MonitorConfig monitor) {
addConfig(monitor, true);
}
Expand All @@ -99,7 +101,7 @@ public Optional<MonitorConfig> getMonitor() {
}

// ModuleConfig correlative methods

@DisableInject
public void setModule(ModuleConfig module) {
addConfig(module, true);
}
Expand All @@ -108,6 +110,7 @@ public Optional<ModuleConfig> getModule() {
return ofNullable(getConfig(getTagName(ModuleConfig.class)));
}

@DisableInject
public void setMetrics(MetricsConfig metrics) {
addConfig(metrics, true);
}
Expand All @@ -116,6 +119,7 @@ public Optional<MetricsConfig> getMetrics() {
return ofNullable(getConfig(getTagName(MetricsConfig.class)));
}

@DisableInject
public void setSsl(SslConfig sslConfig) {
addConfig(sslConfig, true);
}
Expand Down
Expand Up @@ -74,6 +74,7 @@
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.SortedSet;
import java.util.concurrent.CompletableFuture;
Expand Down Expand Up @@ -892,8 +893,17 @@ private DynamicConfiguration prepareEnvironment(ConfigCenterConfig configCenter)
}
try {
environment.setConfigCenterFirst(configCenter.isHighestPriority());
environment.updateExternalConfigurationMap(parseProperties(configContent));
environment.updateAppExternalConfigurationMap(parseProperties(appConfigContent));
Map<String, String> globalRemoteProperties = parseProperties(configContent);
if (CollectionUtils.isEmptyMap(globalRemoteProperties)) {
logger.info("No global configuration in config center");
}
environment.updateExternalConfigurationMap(globalRemoteProperties);

Map<String, String> appRemoteProperties = parseProperties(appConfigContent);
if (CollectionUtils.isEmptyMap(appRemoteProperties)) {
logger.info("No application level configuration in config center");
}
environment.updateAppExternalConfigurationMap(appRemoteProperties);
} catch (IOException e) {
throw new IllegalStateException("Failed to parse configurations from Config Center.", e);
}
Expand Down
Expand Up @@ -420,8 +420,7 @@ public static void validateSslConfig(SslConfig sslConfig) {
public static void validateMonitorConfig(MonitorConfig config) {
if (config != null) {
if (!config.isValid()) {
logger.info("There's no valid monitor config found, if you want to open monitor statistics for Dubbo, " +
"please make sure your monitor is configured properly.");
logger.info("No valid monitor config found, specify monitor info to enable collection of Dubbo statistics");
}

checkParameterName(config.getParameters());
Expand Down
Expand Up @@ -349,7 +349,6 @@ public void addObjectAttachmentsIfAbsent(Map<String, Object> attachments) {
}

@Override
@Deprecated
public String getAttachment(String key) {
if (attachments == null) {
return null;
Expand Down