Last active
December 12, 2017 10:24
-
-
Save e7/034ebda9527d6ad8ac1905e7faf71e7a to your computer and use it in GitHub Desktop.
apache commons configuration2 read config from both local and network
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
XMLConfiguration cnf; | |
{ // remote | |
cnf = new BasicConfigurationBuilder<>(XMLConfiguration.class) | |
.configure(new Parameters().xml()).getConfiguration(); | |
InputStream is = new ByteArrayInputStream( | |
"xxxxxxxxxxxx".getBytes() | |
); | |
new FileHandler(cnf).load(is); | |
} | |
{ // local | |
cnf = new FileBasedConfigurationBuilder<>(XMLConfiguration.class) | |
.configure(new Parameters().xml().setFileName("xxxxxxx")) | |
.getConfiguration(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment