How to parse YAML file to a Java class
问题 I have a class Recipe that represents this YAML block: id: Ex1 uses: - Database: ["D1", "D2"] - MetaFeature: ["M1", "M2"] - Algorithm: ["A1", "A2"] - Config: ["C1", "C4"] public class Recipe { private String id; private HashMap<String, HashSet<String>> uses; } Is there a way to parse this YAML to Recipe class without creating other classes or doing some tricks? 回答1: Firs of all, you have to include SnakeYML as dependency in maven pom.xml. I provide below the maven dependency for snakeyml.