File file = ResourceUtils.getFile(filePath);
in = new BufferedInputStream(new FileInputStream(file));
Yaml props = new Yaml();
ResourceUtils 读取yaml文件中key 对应的,这个依赖是哪个呢?
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.26</version>
</dependency>
读取yaml文件中配置,用@Value注解就可以直接取值了。不需要那么麻烦。
import org.springframework.beans.factory.annotation.Value;
YmlTest.class 当前class 类 还是报流已关闭