惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Apple Machine Learning Research
Apple Machine Learning Research
Y
Y Combinator Blog
博客园 - 【当耐特】
V
Visual Studio Blog
GbyAI
GbyAI
V
V2EX
P
Proofpoint News Feed
Microsoft Azure Blog
Microsoft Azure Blog
Microsoft Security Blog
Microsoft Security Blog
D
DataBreaches.Net
Hugging Face - Blog
Hugging Face - Blog
A
About on SuperTechFans
The Cloudflare Blog
阮一峰的网络日志
阮一峰的网络日志
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
N
Netflix TechBlog - Medium
aimingoo的专栏
aimingoo的专栏
B
Blog RSS Feed
量子位
MongoDB | Blog
MongoDB | Blog
有赞技术团队
有赞技术团队
人人都是产品经理
人人都是产品经理
Stack Overflow Blog
Stack Overflow Blog
小众软件
小众软件

博客园 - 荷楠仁

linux监控 nginx配docker-compose NAS存储当IIS虚拟机目录 redis常用命令 linux防火墙开端口 sqlserver常见命令 /var/lib/docker/overlay2/过大 redhat linux设置开机自动启动 vmware 安装redhat7.9无法使用vi vmware扩展虚拟机磁盘 oracle linux 6.8设置时区 linux配制nfs linux配制iscsi vmware nat 设置静态ip linux导入JAVA_HOME不生效 windows后台运行java进程 oracle EF core hello world ubuntu找不到source命令 linux查看当前文件夹下文件和文件夹大小 windows查看端口被谁占用
Java单例模式
荷楠仁 · 2024-07-11 · via 博客园 - 荷楠仁
public enum ConfReader {
    INSTANCE;
    private Conf conf;
    ConfReader() {
        InputStream is = null;
        try {
            File initialFile = new File("conf.yml");
            is = new FileInputStream(initialFile);
            Yaml yaml = new Yaml();
            this.conf = yaml.loadAs(is, Conf.class);
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        } finally {
            try {
                is.close();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }
    public Conf getConf() {
        return this.conf;
    }
}