diff --git a/src/main/java/io/bitsquare/app/BitsquareEnvironment.java b/src/main/java/io/bitsquare/app/BitsquareEnvironment.java
index 7ddf15c5a1..936e1dfc88 100644
--- a/src/main/java/io/bitsquare/app/BitsquareEnvironment.java
+++ b/src/main/java/io/bitsquare/app/BitsquareEnvironment.java
@@ -22,13 +22,13 @@ import io.bitsquare.btc.UserAgent;
import io.bitsquare.btc.WalletService;
import io.bitsquare.gui.ViewCB;
import io.bitsquare.persistence.Persistence;
+import io.bitsquare.util.spring.JOptCommandLinePropertySource;
import java.nio.file.Paths;
import java.util.Properties;
import joptsimple.OptionSet;
-import org.springframework.core.env.JOptCommandLinePropertySource;
import org.springframework.core.env.MutablePropertySources;
import org.springframework.core.env.PropertiesPropertySource;
import org.springframework.core.env.PropertySource;
@@ -64,7 +64,7 @@ public class BitsquareEnvironment extends StandardEnvironment {
private final String appDataDir;
public BitsquareEnvironment(OptionSet options) {
- this(new JOptCommandLinePropertySource(BITSQUARE_COMMANDLINE_PROPERTY_SOURCE_NAME, checkNotNull(options)));
+ this(new JOptCommandLinePropertySource(BITSQUARE_CLASSPATH_PROPERTY_SOURCE_NAME, checkNotNull(options)));
}
BitsquareEnvironment(PropertySource commandLineProperties) {
diff --git a/src/main/java/io/bitsquare/util/spring/JOptCommandLinePropertySource.java b/src/main/java/io/bitsquare/util/spring/JOptCommandLinePropertySource.java
new file mode 100644
index 0000000000..fe5825dda0
--- /dev/null
+++ b/src/main/java/io/bitsquare/util/spring/JOptCommandLinePropertySource.java
@@ -0,0 +1,50 @@
+/*
+ * This file is part of Bitsquare.
+ *
+ * Bitsquare is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * Bitsquare is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Bitsquare. If not, see .
+ */
+
+package io.bitsquare.util.spring;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import joptsimple.OptionSet;
+
+/**
+ * Customizes {@link io.bitsquare.util.spring.JOptCommandLinePropertySource#getOptionValues(String)}
+ * to allow for proper use of {@link joptsimple.ArgumentAcceptingOptionSpec#ofType(Class)}.
+ * To be removed once https://github.com/spring-projects/spring-framework/pull/693 has
+ * been merged and made available in a release.
+ */
+public class JOptCommandLinePropertySource extends org.springframework.core.env.JOptCommandLinePropertySource {
+
+ public JOptCommandLinePropertySource(String name, OptionSet options) {
+ super(name, options);
+ }
+
+ @Override
+ public List getOptionValues(String name) {
+ List> argValues = this.source.valuesOf(name);
+ List stringArgValues = new ArrayList<>();
+ for (Object argValue : argValues) {
+ stringArgValues.add(argValue instanceof String ? (String) argValue : argValue.toString());
+ }
+ if (stringArgValues.isEmpty()) {
+ return (this.source.has(name) ? Collections.emptyList() : null);
+ }
+ return Collections.unmodifiableList(stringArgValues);
+ }
+}