Skip to content

Commit

Permalink
Add a feature to overwrite application properties with system properties
Browse files Browse the repository at this point in the history
  • Loading branch information
k-tamura committed Jun 13, 2018
1 parent 19a9e8e commit 08c28ce
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public static String getAdminAddress() {

private static String getProperty(ResourceBundle bundle, String key, String defaultValue) {
try {
return bundle.getString(key);
return getProperty(bundle, key);
} catch (Exception e) {
log.error("Exception occurs: ", e);
}
Expand All @@ -180,19 +180,23 @@ private static String getProperty(ResourceBundle bundle, String key, String defa

private static int getProperty(ResourceBundle bundle, String key, int defaultValue) {
try {
return Integer.parseInt(bundle.getString(key));
return Integer.parseInt(getProperty(bundle, key));
} catch (Exception e) {
log.error("Exception occurs: ", e);
}
return defaultValue;
}

private static long getProperty(ResourceBundle bundle, String key, long defaultValue) {
try {
return Long.parseLong(bundle.getString(key));
return Long.parseLong(getProperty(bundle, key));
} catch (Exception e) {
log.error("Exception occurs: ", e);
}
return defaultValue;
}

private static String getProperty(ResourceBundle bundle, String key) {
return System.getProperty(key) != null ? System.getProperty(key) : bundle.getString(key);
}
}

0 comments on commit 08c28ce

Please sign in to comment.