Last active
October 11, 2015 18:17
-
-
Save ramn/3899914 to your computer and use it in GitHub Desktop.
Properties files with Scala
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 java.util.Properties | |
val in = getClass.getClassLoader.getResourceAsStream("config_values.properties") | |
// The Classloader is not always available (sbt test runner), then use the current class instead: | |
// val in = getClass.getResourceAsStream("config_values.properties") | |
val props = new Properties() | |
props.load(in) | |
in.close | |
props.getProperty("my.property.name", "default-value") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment