Yaml yaml = new Yaml();
//使用模板文件构建提交模型时的yaml配置文件
File dumpFile = new File(flinkHome + "/conf/flink-conf.yaml");
Map result = null;
try (InputStream in = new FileInputStream(dumpFile)) {
result = (Map) yaml.load(in);
} catch (Exception e){
throw new DriverException("获取flink-conf配置文件中设置的端口失败!");
}
String port = result.get("rest.port").toString();
Java读取xml配置文件
import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
String flinkConf = null;
try {
SAXReader reader = new SAXReader();
Document document = reader.read("flink-conf.xml").getDocument();
for (Element element : document.getRootElement().elements()) {
if ("flink-yaml".equals(element.element("name").getText())) {