@Test public void testGetPropertiesForFailureWithWrongPath() { String path = ".././quartz.properties"; Properties properties = PropertiesUtil.getProperties(path, new ClassPathResource(path)); assertEquals(properties, null); }
public static Properties getProperties(String path, Resource resource) { PropertiesFactoryBean propFactoryBean = new PropertiesFactoryBean(); Properties properties = null; try { propFactoryBean.setLocation(resource); propFactoryBean.afterPropertiesSet(); properties = propFactoryBean.getObject(); LOGGER.info("Read properties successfully from {}.", path); } catch (IOException e) { LOGGER.error("Get properties from {} failed. {}", path, e); } return properties; }
PropertiesUtil { public static Properties getProperties(String path, Resource resource) { PropertiesFactoryBean propFactoryBean = new PropertiesFactoryBean(); Properties properties = null; try { propFactoryBean.setLocation(resource); propFactoryBean.afterPropertiesSet(); properties = propFactoryBean.getObject(); LOGGER.info("Read properties successfully from {}.", path); } catch (IOException e) { LOGGER.error("Get properties from {} failed. {}", path, e); } return properties; } }
PropertiesUtil { public static Properties getProperties(String path, Resource resource) { PropertiesFactoryBean propFactoryBean = new PropertiesFactoryBean(); Properties properties = null; try { propFactoryBean.setLocation(resource); propFactoryBean.afterPropertiesSet(); properties = propFactoryBean.getObject(); LOGGER.info("Read properties successfully from {}.", path); } catch (IOException e) { LOGGER.error("Get properties from {} failed. {}", path, e); } return properties; }  }
PropertiesUtil { public static Properties getProperties(String path, Resource resource) { PropertiesFactoryBean propFactoryBean = new PropertiesFactoryBean(); Properties properties = null; try { propFactoryBean.setLocation(resource); propFactoryBean.afterPropertiesSet(); properties = propFactoryBean.getObject(); LOGGER.info("Read properties successfully from {}.", path); } catch (IOException e) { LOGGER.error("Get properties from {} failed. {}", path, e); } return properties; }  static Properties getProperties(String path, Resource resource); static Properties getConf(String name, String defaultPath,
                                     String location); static String getConfPath(String name, String location); }
PropertiesUtil { public static Properties getProperties(String path, Resource resource) { PropertiesFactoryBean propFactoryBean = new PropertiesFactoryBean(); Properties properties = null; try { propFactoryBean.setLocation(resource); propFactoryBean.afterPropertiesSet(); properties = propFactoryBean.getObject(); LOGGER.info("Read properties successfully from {}.", path); } catch (IOException e) { LOGGER.error("Get properties from {} failed. {}", path, e); } return properties; }  static Properties getProperties(String path, Resource resource); static Properties getConf(String name, String defaultPath,
                                     String location); static String getConfPath(String name, String location);  }