Reading a properties file in Java way

At work we had to read from a properties file for dummy data entries, but we have encountered encoding issues in the Turkish language. So we had come to use this way that you can read from a properties file also you can prohibit encoding issues while attempting to read it using Spring.

private Properties props = new Properties();
private File resourceFile;
resourceFile = resourceLoader.getResource("classpath:/bundle/agreementdata.properties").getFile();
			props.load(new InputStreamReader(new FileInputStream(resourceFile), "UTF-8"));

//to get the data from the file
props.getProperty("LINENAME")

Leave a Reply

Your email address will not be published. Required fields are marked *