Load initial data in Play 2.0+

playframework, playframework-2.0

Solution

Nope, it wasn't dropped, just refactored. The main weight was moved to the the Global object and its `onStart()` method.

Using it you can perform common DB operations as well you can also load and traverse any `YAML` file. Check the Zentasks sample to see how to use it in your own app (especially: `app/Global.java`, `conf/initial-data.yml`); for instance, from the sample:

Map<String,List<Object>> all = (Map<String,List<Object>>)Yaml.load("initial-data.yml");

It's just beginning! Using `Global object` depends only on your imaginary!

Problem

I'm creating a Play framework application, and I need to load in some data. The framework (I've done some work with it when it was at 1.2.4, and now I've been trying out 2.0.3) used to support the creation of a `data.yaml` file, which could be loaded in on runtime. Support for this appears to have been dropped. What is the best practice for going about this now?

Original source