How to read a configuration as a key value pair from appln.conf in Play Framework 2.3
The Play application.conf make use of
Hope this helps :)
The Play application.conf make use of
HOCON (Human-Optimized Config Object Notation)
This is how the entry would look like in appln.conf
vehicle.config="{'car':'Toyota','truck':'FreightLiner','"
vehicle.config=${vehicle.config}"'van':'Ford','jeep':'Chrysler'}"
Java code would look like
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
private static final String CONFIG = Play.application()
.configuration().getString("vehicle.config");
Gson gson = new Gson();
Type collectionType = new TypeToken
MapconfigMap = gson.fromJson(CONFIG, collectionType);
Hope this helps :)
1 comment:
Just wish to say your article is as astounding. The clearness in your
submit is just excellent and i can suppose you’re knowledgeable in this subject.
Well along with your permission allow me to take hold of your RSS feed to stay up
to date with drawing close post. Thanks a million and
please carry on the rewarding work.
AngularJS Certification Training in Chennai
Post a Comment