We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
`` diff --git a/src/main/java/xyz/redtorch/trader/base/BaseConfig.java b/src/main/java/xyz/redtorch/trader/base/BaseConfig.java index 293ee63..e6da1f1 100644 --- a/src/main/java/xyz/redtorch/trader/base/BaseConfig.java +++ b/src/main/java/xyz/redtorch/trader/base/BaseConfig.java @@ -1,9 +1,13 @@ package xyz.redtorch.trader.base;
+import java.net.MalformedURLException; +import java.net.URL; + import org.apache.commons.configuration2.CompositeConfiguration; import org.apache.commons.configuration2.PropertiesConfiguration; import org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder; import org.apache.commons.configuration2.builder.fluent.Parameters; +import org.apache.commons.configuration2.builder.fluent.PropertiesBuilderParameters; import org.apache.commons.configuration2.convert.DefaultListDelimiterHandler; import org.apache.commons.configuration2.ex.ConfigurationException; import org.slf4j.Logger; @@ -16,19 +20,56 @@ public static CompositeConfiguration rtConfig; static { rtConfig = new CompositeConfiguration();
try {
FileBasedConfigurationBuilder<PropertiesConfiguration> builder =
new FileBasedConfigurationBuilder<PropertiesConfiguration>(PropertiesConfiguration.class)
.configure(new Parameters().properties()
.setFileName("RtConfig.properties")
.setThrowExceptionOnMissing(true)
.setListDelimiterHandler(new DefaultListDelimiterHandler(';'))
.setIncludesAllowed(false));
PropertiesConfiguration propertiesConfiguration = builder.getConfiguration();
rtConfig.addConfiguration(propertiesConfiguration);
} catch (ConfigurationException e) {
log.error("配置文件RtConfig.properties加载失败",e);
throw new Error("配置文件RtConfig.properties加载失败");
}
PropertiesBuilderParameters params = new Parameters().properties()
.setIncludesAllowed(false);
if(!tryConfig(params,"file:./config/RtConfig.properties"))
{
if(!tryConfig(params,"file:./RtConfig.properties"))
if(!tryConfig(params,"classpath:/config/RtConfig.properties"))
if(!tryConfig(params,"classpath:/RtConfig.properties"))
log.error("配置文件RtConfig.properties加载失败");
URL configFileUrl = new URL(config_url_txt);
.configure(params.setURL(configFileUrl));
return true;
log.debug("配置文件RtConfig.properties加载失败",e);
return false;
}catch (MalformedURLException e)
The text was updated successfully, but these errors were encountered:
感谢提供代码支持,为了增强兼容性,会对上述代码修改后并入
Sorry, something went wrong.
ebbc4e0
No branches or pull requests
``
diff --git a/src/main/java/xyz/redtorch/trader/base/BaseConfig.java b/src/main/java/xyz/redtorch/trader/base/BaseConfig.java
index 293ee63..e6da1f1 100644
--- a/src/main/java/xyz/redtorch/trader/base/BaseConfig.java
+++ b/src/main/java/xyz/redtorch/trader/base/BaseConfig.java
@@ -1,9 +1,13 @@
package xyz.redtorch.trader.base;
+import java.net.MalformedURLException;
+import java.net.URL;
+
import org.apache.commons.configuration2.CompositeConfiguration;
import org.apache.commons.configuration2.PropertiesConfiguration;
import org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder;
import org.apache.commons.configuration2.builder.fluent.Parameters;
+import org.apache.commons.configuration2.builder.fluent.PropertiesBuilderParameters;
import org.apache.commons.configuration2.convert.DefaultListDelimiterHandler;
import org.apache.commons.configuration2.ex.ConfigurationException;
import org.slf4j.Logger;
@@ -16,19 +20,56 @@
public static CompositeConfiguration rtConfig;
static {
rtConfig = new CompositeConfiguration();
}
The text was updated successfully, but these errors were encountered: