import java.util.ResourceBundle;

/**
 * 读取properties文件的帮助类
 * @author 
 */
public class PropertiesUtil {

 public static String getPropertyValue(String fileName, String key) {
  ResourceBundle bundle = ResourceBundle.getBundle(fileName);
  String value = bundle.getString(key);
  return value;
 }

}

  使用时只需要执行以下代码就可以获取到application.properties配置文件中img.upload的值

public static final String IMG_UPLOAD = PropertiesUtil.getPropertyValue("application", "img.upload");

相关文章:

  • 2021-05-22
  • 2022-01-15
  • 2021-09-14
  • 2022-12-23
  • 2022-03-06
  • 2022-01-02
  • 2021-07-11
  • 2022-12-23
猜你喜欢
  • 2021-12-23
  • 2021-11-19
  • 2022-02-24
  • 2021-10-12
  • 2022-12-23
  • 2021-09-20
相关资源
相似解决方案