public class StdMainStringArgsLoader extends KeyValuePairLoader implements StandardLoader
String[] args passed to the main(String[] args), which Java
passes from the command line. This is the most common usage, however, your
application may retrieve an array of String's from anywhere to pass
to AndHow at startup.
import org.yarnandtail.andhow.*;
public class MyAppClass {
public static void main(String[] args) {
AndHow.findConfig()
.setCmdLineArgs(args)
.build();
}
}
Passing values from the command line looks like this:
java -jar MyJarName.jar full.name.of.MY_PROPERTY=someValue
Here is a complete example of using command line arguments.
StandardLoader's, this loader is intended to be auto-created
by AndHow. The set of standard loaders and their order can bet set
via the AndHowConfiguration.setStandardLoaders() methods.
Other loaders which don't implement the StandardLoader interface can
be inserted into the load order via the
AndHowConfiguration.insertLoaderBefore/After().KVP_DELIMITER, unknownPropertyAProblem| Constructor and Description |
|---|
StdMainStringArgsLoader()
There is no reason to use the constructor in production application code
because AndHow creates a single instance on demand at runtime.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getSpecificLoadDescription()
For this particular load, where was info loaded from?
This may vary from run to run based on config params.
|
getLoaderDialect, getLoaderType, isTrimmingRequiredForStringValues, isUnknownPropertyAProblem, load, releaseResources, setKeyValuePairs, setKeyValuePairs, setUnknownPropertyAProblemattemptToAdd, attemptToAdd, attemptToAdd, attemptToAddIfNotDuplicate, createValue, findDuplicateProperty, getClassConfig, getConfigSamplePrinter, getInstanceConfig, mapNametoPropertyclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetClassConfig, getConfigSamplePrinter, getInstanceConfig, getLoaderDialect, getLoaderType, isTrimmingRequiredForStringValues, load, releaseResourcespublic StdMainStringArgsLoader()
public String getSpecificLoadDescription()
LoadergetSpecificLoadDescription in interface LoadergetSpecificLoadDescription in class KeyValuePairLoaderCopyright © 2021. All rights reserved.