yaml
database:
url: jdbc:mysql://localhost:3306/mydatabase
username: myusername
password: mypassword
import org.yaml.snakeyaml.Yaml;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Map;
public class Main {
public static void main(String[] args) {
try {
InputStream input = new FileInputStream("config.yml");
Yaml yaml = new Yaml();
Map<String, Object> data = yaml.load(input);
System.out.println(data.get("database"));
} catch (Exception e) {
e.printStackTrace();
}
}
}