Use hazelcast's Config.loadFromStream()

To allow the private function Config.applyEnvAndSystemVariableOverrides()
to override with environment variables

See gh-33687
pull/34049/head
lucas persson 2 years ago committed by Moritz Halbritter
parent 48db5ff35c
commit 275f15b8d3

@ -20,8 +20,6 @@ import java.io.IOException;
import java.net.URL;
import com.hazelcast.config.Config;
import com.hazelcast.config.XmlConfigBuilder;
import com.hazelcast.config.YamlConfigBuilder;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.spring.context.SpringManagedContext;
@ -78,7 +76,7 @@ class HazelcastServerConfiguration {
private Config loadConfig(Resource configLocation) throws IOException {
URL configUrl = configLocation.getURL();
Config config = loadConfig(configUrl);
Config config = Config.loadFromStream(configUrl.openStream());
if (ResourceUtils.isFileURL(configUrl)) {
config.setConfigurationFile(configLocation.getFile());
}
@ -88,14 +86,6 @@ class HazelcastServerConfiguration {
return config;
}
private static Config loadConfig(URL configUrl) throws IOException {
String configFileName = configUrl.getPath();
if (configFileName.endsWith(".yaml") || configFileName.endsWith(".yml")) {
return new YamlConfigBuilder(configUrl).build();
}
return new XmlConfigBuilder(configUrl).build();
}
}
@Configuration(proxyBeanMethods = false)

Loading…
Cancel
Save