java get properties file

java get properties file


// String title = "行政院农业委员会农粮署";
        InputStream inputStream = this.getClass().getClassLoader()
                .getResourceAsStream("Messages.properties");
        Properties properties = new Properties();
        // load the inputStream using the Properties
        try {
            properties.load(inputStream);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            throw new RuntimeException(e);
        }
        // get the value of the property
        String propValue = properties.getProperty("reportTitle");
        log.info("propValue" + propValue);
        builder.addParameter("reportTitle", propValue);

Original: Big Box  java get properties file


Guess you like

Origin www.cnblogs.com/chinatrump/p/11514237.html