Load initial data in Play 2.0+

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?

Answers


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!


Need Your Help

What should the Primary Key be?

mysql sql database

I've ran into an issue that I can't seem to solve.

Communicating with server with Backbone.js

php javascript backbone.js

I'm a newbie web developer diving into Backbone for the first time. One major question I've been grappling with (actually spending a lot of the last 2 days researching to no avail) is how exactly

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.