根据key获取property文件中的值工具类

来源:互联网 发布:北大口腔医院 知乎 编辑:程序博客网 时间:2024/05/10 02:46
private static final String BUNDLE_NAME = "org.jboss.messages";//属性文件所在位置    private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);    private ZteMessages()    {    }    public static String getString(String key)    {        // System.out.println(Locale.getDefault());        try        {            return RESOURCE_BUNDLE.getString(key);        }        catch (MissingResourceException e)        {            return '!' + key + '!';        }    }

0 0