spring - Loading Java Properties Files by Profile -
i want load properties files in java code. use profile config -dspring.profiles.active=local or dev... how load properties files profile this:
classpath:${spring.profiles.active}/test.properties
how in java code ? did below, null.
properties prop = new properties(); inputstream istream = helper.class.getclassloader().getresourceasstream("test.properties"); try { prop.load(istream); } catch (ioexception e) { log.error(e.getmessage(), e); } { try { istream.close(); } catch (ioexception e) { log.error(e.getmessage(), e); } }
Comments
Post a Comment