一、yaml配置文件转换为java bean:
需要的jar包
<dependency> <groupId>org.yaml</groupId> <artifactId>snakeyaml</artifactId> </dependency>
代码的实例:
Yaml yaml = new Yaml(); MsbConfig config = yaml.loadAs(new FileInputStream(new File(configFile)), MsbConfig.class);
需要的jar包
<dependency> <groupId>org.yaml</groupId> <artifactId>snakeyaml</artifactId> </dependency>
代码的实例:
Yaml yaml = new Yaml(); MsbConfig config = yaml.loadAs(new FileInputStream(new File(configFile)), MsbConfig.class);