Created
May 23, 2016 12:26
-
-
Save fedotxxl/fdffb9d8475b43b34dc1ef05c3d19ffa to your computer and use it in GitHub Desktop.
This file contains hidden or 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
//<import resource="applicationContext.log.db.${log.to.db:false}.xml"/> | |
//http://stackoverflow.com/questions/3035630/how-to-achieve-conditional-resource-import-in-a-spring-xml-context | |
private void loadConditionalProperties() { | |
try { | |
Properties properties = new Properties(); | |
try (InputStream stream = FileUtils.openInputStream(new File(getDefaultConfigPath()))) { | |
properties.load(stream); | |
} | |
System.setProperty("log.to.db", properties.getProperty("log.to.db", "false")); | |
} catch (Exception e) { | |
loge.error("context.conditional.e", e); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment