You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2013/04/03 15:16:00 UTC

svn commit: r1463993 - /camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/BridgePropertyPlaceholderConfigurer.java

Author: davsclaus
Date: Wed Apr  3 13:16:00 2013
New Revision: 1463993

URL: http://svn.apache.org/r1463993
Log:
CAMEL-6233: BridgePropertyPlaceholderConfigurer does not support nested Spring properties

Modified:
    camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/BridgePropertyPlaceholderConfigurer.java

Modified: camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/BridgePropertyPlaceholderConfigurer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/BridgePropertyPlaceholderConfigurer.java?rev=1463993&r1=1463992&r2=1463993&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/BridgePropertyPlaceholderConfigurer.java (original)
+++ camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/BridgePropertyPlaceholderConfigurer.java Wed Apr  3 13:16:00 2013
@@ -42,13 +42,23 @@ public class BridgePropertyPlaceholderCo
     private String id;
     private PropertyPlaceholderHelper helper;
 
+    // to support both Spring 3.0 / 3.1+ we need to keep track of these as they have private modified in Spring 3.0
+    private String configuredPlaceholderPrefix;
+    private String configuredPlaceholderSuffix;
+    private String configuredValueSeparator;
+    private Boolean configuredIgnoreUnresolvablePlaceholders;
+
     @Override
     protected void processProperties(ConfigurableListableBeanFactory beanFactoryToProcess, Properties props) throws BeansException {
         super.processProperties(beanFactoryToProcess, props);
         // store all the spring properties so we can refer to them later
         properties.putAll(props);
         // create helper
-        helper = new PropertyPlaceholderHelper(placeholderPrefix, placeholderSuffix, valueSeparator, ignoreUnresolvablePlaceholders);
+        helper = new PropertyPlaceholderHelper(
+                configuredPlaceholderPrefix != null ? configuredPlaceholderPrefix : DEFAULT_PLACEHOLDER_PREFIX,
+                configuredPlaceholderSuffix != null ? configuredPlaceholderSuffix : DEFAULT_PLACEHOLDER_SUFFIX,
+                configuredValueSeparator != null ? configuredValueSeparator : DEFAULT_VALUE_SEPARATOR,
+                configuredIgnoreUnresolvablePlaceholders != null ? configuredIgnoreUnresolvablePlaceholders : false);
     }
 
     @Override
@@ -58,6 +68,30 @@ public class BridgePropertyPlaceholderCo
     }
 
     @Override
+    public void setPlaceholderPrefix(String placeholderPrefix) {
+        super.setPlaceholderPrefix(placeholderPrefix);
+        this.configuredPlaceholderPrefix = placeholderPrefix;
+    }
+
+    @Override
+    public void setPlaceholderSuffix(String placeholderSuffix) {
+        super.setPlaceholderSuffix(placeholderSuffix);
+        this.configuredPlaceholderSuffix = placeholderSuffix;
+    }
+
+    @Override
+    public void setValueSeparator(String valueSeparator) {
+        super.setValueSeparator(valueSeparator);
+        this.configuredValueSeparator = valueSeparator;
+    }
+
+    @Override
+    public void setIgnoreUnresolvablePlaceholders(boolean ignoreUnresolvablePlaceholders) {
+        super.setIgnoreUnresolvablePlaceholders(ignoreUnresolvablePlaceholders);
+        this.configuredIgnoreUnresolvablePlaceholders = ignoreUnresolvablePlaceholders;
+    }
+
+    @Override
     public Properties resolveProperties(CamelContext context, boolean ignoreMissingLocation, String... uri) throws Exception {
         // return the spring properties, if it
         Properties answer = new Properties();