ITeye博客

项目中解析配置文件的工具类

一杯白开水w · 2014-07-16 10:05 · J2EE · 编程语言 · Markdown

项目中解析配置文件的工具类

package com.sohu.cloudno.util;

import java.util.ResourceBundle;

/**
 * 项目参数工具类
 * 
 * 
 */
public class ConfigUtil {

	private static final ResourceBundle bundle = java.util.ResourceBundle.getBundle("config");

	/**
	 * 获得sessionInfo名字
	 * 
	 * @return
	 */
	public static final String getSessionInfoName() {
		return bundle.getString("sessionInfoName");
	}

	/**
	 * 通过键获取值
	 * 
	 * @param key
	 * @return
	 */
	public static final String get(String key) {
		if(!bundle.containsKey(key)){
			return null;
		}else{
			return bundle.getString(key);
		}
		
		
	}

}

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。