Playframework: Best Solution for loading & using constant Strings
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 ht开发者_JS百科tp://www.playframework.org/documentation/1.2.2/i18n#messages
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 :)
Update: found the solution http://www.playframework.org/documentation/1.2.2/i18n#messages
精彩评论