June 2018
Beginner
722 pages
18h 47m
English
Alternatively, we could use another JSON processing API and its implementation:
<dependency> <groupId>javax.json</groupId> <artifactId>javax.json-api</artifactId> <version>1.1.2</version></dependency><dependency> <groupId>org.glassfish</groupId> <artifactId>javax.json</artifactId> <version>1.1.2</version></dependency>
Then the code of the getStringValueFromConfig() method would look slightly different:
import javax.json.Json;import javax.json.JsonObject;import javax.json.JsonReader;public class Utils { private static JsonObject config = null; public static String getStringValueFromConfig(String FileName, String key){ if(config == null){ ClassLoader classLoader = Utils.class.getClassLoader(); File file = new File(classLoader.getResource(fileName).getFile()) ...
Read now
Unlock full access