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

推荐订阅源

雷峰网
雷峰网
IT之家
IT之家
Last Week in AI
Last Week in AI
J
Java Code Geeks
L
LangChain Blog
Recent Announcements
Recent Announcements
Martin Fowler
Martin Fowler
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Google DeepMind News
Google DeepMind News
博客园 - Franky
博客园 - 司徒正美
月光博客
月光博客
博客园 - 叶小钗
Vercel News
Vercel News
腾讯CDC
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
小众软件
小众软件
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
GbyAI
GbyAI
B
Blog RSS Feed
人人都是产品经理
人人都是产品经理
H
Help Net Security
G
Google Developers Blog
D
DataBreaches.Net

博客园 - 荷楠仁

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;
    }
}