---
title: "读取配置文件"
author: "ts88"
date: "2013-07-10T10:55:32Z"
tags: []
categories: ["企业架构"]
slug: "untitled"
draft: false
lastmod: "2013-07-10T10:55:46Z"
id: 1902377
url: "https://ts88.iteye.com/blog/1902377"
---

```
@Test
public void readRropertory() {
Properties properties = new Properties();
try {
       properties.load(this.getClass().getResourceAsStream("/conf/sample-setting.properties"));
       System.out.println(properties.get("envName"));
        } catch (IOException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
        }
}
```