須要的jar包java
<dependency> <groupId>org.yaml</groupId> <artifactId>snakeyaml</artifactId> </dependency>
代碼的實例:spa
Yaml yaml = new Yaml(); MsbConfig config = yaml.loadAs(new FileInputStream(new File(configFile)), MsbConfig.class);