I need to add some properties file to my application. I have added this file to controller
directory, but can't load them (no in classpath ?) - InputStream
is null. Where to put this file to can be accessed ?
public class Application extends Controller {
static {
try {
Properties p = new Properties();
InputStream in = Application.class.getClassLoader().getResourceAsStream("accounts.properties");
if(in != null) {
p.load(in);
in.close();
} else {
error("null inputstream");
}
} catch (Exception e) {
e.printStackTrace();
}
}
// Actions below
// ...
}
You have to put it in the
conf
folder of your Play app.You can also use subfolder in the
conf
directory.For instance:
can be accessed using:
You can also add a custom resources directory in your app, by updating your
project/Build.scala
file and adding: