public class ABCD{private String HDFS_HOST; private String FILE_LOCAL; private String HDFS_USER; private String HDFS_FILE_PATH; { Properties properties = new Properties(); ClassLoader classLoader = ABCD.class.getClassLoader(); InputStream inputStream = classLoader.getResourceAsStream("./application.properties"); try { properties.load(inputStream); } catch (IOException e) { e.printStackTrace(); } HDFS_HOST = properties.getProperty("file.hdfs.host"); FILE_LOCAL = properties.getProperty("file.local"); HDFS_USER = properties.getProperty("hdfs.user"); HDFS_FILE_PATH = properties.getProperty("hdfs.file.path"); }}
以下为application.properties 文件内容



