issues/1407: make `ConfigurationResourceResolver` use Environment
proeprties instead of System properties
@@ -10,6 +10,7 @@ import java.nio.file.Paths;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.core.env.Environment;
import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;
@@ -27,6 +28,9 @@ public class ConfigurationResourceResolver
@Inject
private PropertiesBooter propertiesBooter;
+ @Inject
+ private Environment environment;
+
public Resource getConfigurationResource(String propertyKey,
String propertyDefaultValue)
@@ -67,10 +71,9 @@ public class ConfigurationResourceResolver
return new FileSystemResource(file);
});
- if (System.getProperty(propertyKey) != null)
+ String filename;
+ if ((filename = getProperty(propertyKey)) != null)
{
- String filename = System.getProperty(propertyKey);
-
logger.debug(String.format("Using configured resource path [%s]", filename));
return resourceLoader.getResource(filename);
@@ -101,4 +104,9 @@ public class ConfigurationResourceResolver
}
}
+ private String getProperty(String propertyKey)
+ {
+ return environment.getProperty(propertyKey);
+ }
+
}
