META-INF下文件读取

protected String getProperty(String name) {
        String file = "/META-INF/jndi.properties";
        URL fileURL = this.getClass().getResource(file);
        if (fileURL != null) {
            try {
                props.load(this.getClass().getResourceAsStream(file));
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return props.getProperty(name);
    }

posted @ 2018-10-18 15:58  有梦就能实现  阅读(2180)  评论(0编辑  收藏  举报