class ResourcesUtils {

    public static String loadResource(String resourceName, boolean exceptionWhenNotFound) {
        try {
            URL url = Resources.getResource(resourceName);
            return Resources.toString(url, Charsets.UTF_8);
        } catch (Exception e) {
            log.error("Error loading resource '"+resourceName+"'", e);
            if(exceptionWhenNotFound){
                throw new RuntimeException("Error loading required resource '"+resourceName+"'");
            }
            return null;
        }
    }

    private  ResourcesUtils();

}