You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2014/06/11 10:54:52 UTC

[2/2] git commit: CAMEL-7496 BridgePropertyPlaceholderConfigurer should take ignoreResourceNotFound into consideration when it loads the property files

CAMEL-7496 BridgePropertyPlaceholderConfigurer should take ignoreResourceNotFound into consideration when it loads the property files


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/47a9298f
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/47a9298f
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/47a9298f

Branch: refs/heads/master
Commit: 47a9298faa4edc1152649e742fce9b811c5e80f6
Parents: 686ff1f
Author: Willem Jiang <wi...@gmail.com>
Authored: Wed Jun 11 16:51:40 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Wed Jun 11 16:54:21 2014 +0800

----------------------------------------------------------------------
 .../spi/BridgePropertyPlaceholderConfigurer.java      | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/47a9298f/components/camel-spring/src/main/java/org/apache/camel/spring/spi/BridgePropertyPlaceholderConfigurer.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/spi/BridgePropertyPlaceholderConfigurer.java b/components/camel-spring/src/main/java/org/apache/camel/spring/spi/BridgePropertyPlaceholderConfigurer.java
index 17b4b1f..3108acf 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/spi/BridgePropertyPlaceholderConfigurer.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/spi/BridgePropertyPlaceholderConfigurer.java
@@ -49,6 +49,7 @@ public class BridgePropertyPlaceholderConfigurer extends PropertyPlaceholderConf
     private String configuredValueSeparator;
     private Boolean configuredIgnoreUnresolvablePlaceholders;
     private int systemPropertiesMode = SYSTEM_PROPERTIES_MODE_FALLBACK;
+    private Boolean ignoreResourceNotFound;
 
     @Override
     protected void processProperties(ConfigurableListableBeanFactory beanFactoryToProcess, Properties props) throws BeansException {
@@ -105,6 +106,12 @@ public class BridgePropertyPlaceholderConfigurer extends PropertyPlaceholderConf
         super.setIgnoreUnresolvablePlaceholders(ignoreUnresolvablePlaceholders);
         this.configuredIgnoreUnresolvablePlaceholders = ignoreUnresolvablePlaceholders;
     }
+    
+    @Override
+    public void setIgnoreResourceNotFound(boolean ignoreResourceNotFound) {
+        super.setIgnoreResourceNotFound(ignoreResourceNotFound);
+        this.ignoreResourceNotFound = ignoreResourceNotFound;
+    }
 
     @Override
     public Properties resolveProperties(CamelContext context, boolean ignoreMissingLocation, String... uri) throws Exception {
@@ -115,7 +122,12 @@ public class BridgePropertyPlaceholderConfigurer extends PropertyPlaceholderConf
             if (ref.equals(u)) {
                 answer.putAll(properties);
             } else if (resolver != null) {
-                Properties p = resolver.resolveProperties(context, ignoreMissingLocation, u);
+                boolean flag = ignoreMissingLocation;
+                // Override the setting by using ignoreResourceNotFound
+                if (ignoreResourceNotFound != null) {
+                    flag = ignoreResourceNotFound;
+                }
+                Properties p = resolver.resolveProperties(context, flag, u);
                 if (p != null) {
                     answer.putAll(p);
                 }