Playframework: Best Solution for loading & using constant Strings

1.1k views Asked by At

I have a bunch of static Strings that I'd like to store in a .yml file. What's the best design practice to load them to a Java Class & use it.

In other words, I'm looking for an Application-wide Singleton class holding resource strings, but confused as to where to put them (Models, Controllers).

I also don't want to make any obvious mistakes that'll hit performance

Update: found the solution http://www.playframework.org/documentation/1.2.2/i18n#messages

2

There are 2 answers

0
roshan On BEST ANSWER
0
cdegroot On

Although you found the solution, just a little note - by convention, most of your code lives in the "controllers", "models", and "views" packages (and the "notifiers" package if you use stuff like templated mail), but nothing bars you of adding more of your own. I often end up with at least a "utils" package :)