diff --git a/common/src/main/java/com/jeesite/common/io/PropertiesUtils.java b/common/src/main/java/com/jeesite/common/io/PropertiesUtils.java index ece83262..4530e3cc 100644 --- a/common/src/main/java/com/jeesite/common/io/PropertiesUtils.java +++ b/common/src/main/java/com/jeesite/common/io/PropertiesUtils.java @@ -105,18 +105,19 @@ public class PropertiesUtils { */ public PropertiesUtils(String... configFiles) { for (String location : configFiles) { - try { - Resource resource = ResourceUtils.getResource(location); - if (resource.exists()){ - if (location.endsWith(".properties")){ - try (InputStreamReader is = new InputStreamReader(resource.getInputStream(), "UTF-8")){ - properties.load(is); - configSet.add(location); - } catch (IOException ex) { - logger.error("Load " + location + " failure. ", ex); - } + Resource resource = ResourceUtils.getResource(location); + if (resource.exists()){ + if (location.endsWith(".properties")){ + try (InputStreamReader is = new InputStreamReader(resource.getInputStream(), "UTF-8")){ + properties.load(is); + configSet.add(location); + } catch (IOException e) { + System.err.println("Load " + location + " failure."); + e.printStackTrace(); } - else if (location.endsWith(".yml")){ + } + else if (location.endsWith(".yml")){ + try { YamlPropertiesFactoryBean bean = new YamlPropertiesFactoryBean(); bean.setResources(resource); for (Map.Entry entry : bean.getObject().entrySet()){ @@ -124,10 +125,11 @@ public class PropertiesUtils { ObjectUtils.toString(entry.getValue())); } configSet.add(location); - } - } - } catch (Exception e) { - logger.error("Load " + location + " failure. ", e); + } catch (Exception e) { + System.err.println("Load " + location + " failure."); + e.printStackTrace(); + } + } } } properties.put("configFiles", StringUtils.join(configFiles, ","));