1.首先对照properties文件新建一个property的实体类,在实体类的构造方法里使用java提供的Properties类的load()方法接收properties文件的输入流,然后把文件中配置的属性和属性值分割后加载到我们自己建立的Property类里。
(1)要有一个config.properties文件,格式如下:
#引号中内容的最大长度
maxQuoLength = 6
#引号中内容的最小长度
minQuoLength = 2
(2)Property类:
使用Java.Util.Properties类的load()来加载
Properties p=new Properties();
InputStream is = null;
try {
is = new FileInputStream("config.