可以使用一下的工具
package com.qn.core.util; import java.text.MessageFormat; import java.util.ResourceBundle; /** * 资源文件工具类 */ public class ResourceUtil { private ResourceBundle resourceBundle; private ResourceUtil(String resource) { resourceBundle = ResourceBundle.getBundle(resource); } public static ResourceUtil getResource(String resource) { return new ResourceUtil(resource); } public String getValue(String key) { return resourceBundle.getString(key); } public String getValue(String key, Object... args) { String temp = resourceBundle.getString(key); return MessageFormat.format(temp, args); } }