camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [5/8] camel git commit: CAMEL-11321: camel-spring-boot should lazy create ProducerTemplate and ConsumerTemplate so they are only created if really in use.
Date Wed, 05 Jul 2017 07:28:38 GMT
CAMEL-11321: camel-spring-boot should lazy create ProducerTemplate and ConsumerTemplate so
they are only created if really in use.


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

Branch: refs/heads/master
Commit: dcfb01adfa0b713e8b7fda8bdf8bb38cddf3a690
Parents: 253b99c
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Tue Jul 4 14:25:57 2017 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Wed Jul 5 09:28:22 2017 +0200

----------------------------------------------------------------------
 .../apache/camel/component/properties/PropertiesComponent.java  | 4 ++--
 .../org/apache/camel/spring/boot/CamelAutoConfiguration.java    | 5 +++++
 2 files changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/dcfb01ad/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java
b/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java
index d3ba396..b26cdac 100644
--- a/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java
+++ b/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java
@@ -185,7 +185,7 @@ public class PropertiesComponent extends UriEndpointComponent {
         Properties prop = new Properties();
 
         // use initial properties
-        if (null != initialProperties) {
+        if (initialProperties != null) {
             prop.putAll(initialProperties);
         }
 
@@ -590,7 +590,7 @@ public class PropertiesComponent extends UriEndpointComponent {
 
         @Override
         public int hashCode() {
-            return locations != null ? locations.hashCode() : 0;
+            return locations.hashCode();
         }
 
         @Override

http://git-wip-us.apache.org/repos/asf/camel/blob/dcfb01ad/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java
b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java
index 2c9f53d..690c632 100644
--- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java
+++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java
@@ -64,6 +64,7 @@ import org.springframework.context.ApplicationContext;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Import;
+import org.springframework.context.annotation.Lazy;
 import org.springframework.core.env.ConfigurableEnvironment;
 import org.springframework.core.env.Environment;
 import org.springframework.core.env.MutablePropertySources;
@@ -224,6 +225,7 @@ public class CamelAutoConfiguration {
 
     /**
      * Default producer template for the bootstrapped Camel context.
+     * Create the bean lazy as it should only be created if its in-use.
      */
     // We explicitly declare the destroyMethod to be "" as the Spring @Bean
     // annotation defaults to AbstractBeanDefinition.INFER_METHOD otherwise
@@ -232,6 +234,7 @@ public class CamelAutoConfiguration {
     // lifecycle.
     @Bean(destroyMethod = "")
     @ConditionalOnMissingBean(ProducerTemplate.class)
+    @Lazy
     ProducerTemplate producerTemplate(CamelContext camelContext,
                                       CamelConfigurationProperties config) throws Exception
{
         final ProducerTemplate producerTemplate = camelContext.createProducerTemplate(config.getProducerTemplateCacheSize());
@@ -242,6 +245,7 @@ public class CamelAutoConfiguration {
 
     /**
      * Default consumer template for the bootstrapped Camel context.
+     * Create the bean lazy as it should only be created if its in-use.
      */
     // We explicitly declare the destroyMethod to be "" as the Spring @Bean
     // annotation defaults to AbstractBeanDefinition.INFER_METHOD otherwise
@@ -250,6 +254,7 @@ public class CamelAutoConfiguration {
     // lifecycle.
     @Bean(destroyMethod = "")
     @ConditionalOnMissingBean(ConsumerTemplate.class)
+    @Lazy
     ConsumerTemplate consumerTemplate(CamelContext camelContext,
                                       CamelConfigurationProperties config) throws Exception
{
         final ConsumerTemplate consumerTemplate = camelContext.createConsumerTemplate(config.getConsumerTemplateCacheSize());


Mime
View raw message