---
title: "Light-Commons 加入 ExProperties方便Properties文件的中文配置"
author: "jasongreen"
date: "2008-06-19T16:58:57Z"
tags: ["IDE", "Java", "thread"]
slug: "light-commons-exproperties-properties"
draft: false
lastmod: "2008-06-19T16:58:57Z"
id: 205889
url: "https://jasongreen.iteye.com/blog/205889"
---

java中的properties文件中的中文需要用 \uxxxx来表示，非常麻烦。虽然有IDE的帮助，可以减少转码的过程。但这仍然是properties的一大缺陷。因此Light-commons加入了一个ExProperties类。可以支持iso-8859-1以外的编码格式。

#testutf8.properties

> #测试
> 中文名=中文值
> 


#TestExProperties.java

```java
ExProperties exProperties = new ExProperties();
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("testutf8.properties");
exProperties.load(is, "utf-8");
assertEquals("中文值", exProperties.getProperty("中文名"));
```