ant配置文件打包到class目录下

 

 

 

 

 

 

package com.Socket.event;

import java.util.MissingResourceException;
import java.util.ResourceBundle;

import com.Socket.util.LogUtil;

public class FrequencyProperty {

    private static ResourceBundle resourceBundle;

    static {
        String bundleName = "frequency"; // frequency.properties
        try {
            resourceBundle = ResourceBundle.getBundle(bundleName);
        } catch (MissingResourceException mre) {
            LogUtil.error("resource bundle missing: " + bundleName);
        }
    }

    public static int getProperty(String key) {

        String value = "";

        try {
            value = resourceBundle.getString(key);
        } catch (Exception e) {
            return 30;
        }

        return Integer.parseInt(value);
    }

    
}

 

posted @ 2020-12-02 15:52  1156740846  阅读(255)  评论(0编辑  收藏  举报