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 2020/01/07 09:01:09 UTC

[camel] 02/08: CAMEL-14359: camel-bean is now singleton scoped by default (cache=true).

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch bean-scope
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 000fbb01af6676b6f21cc5187cdf296f5ea09965
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Jan 6 11:50:52 2020 +0100

    CAMEL-14359: camel-bean is now singleton scoped by default (cache=true).
---
 .../camel-bean/src/main/docs/bean-component.adoc   | 10 ++--
 .../camel-bean/src/main/docs/class-component.adoc  | 10 ++--
 .../component/bean/AbstractBeanProcessor.java      | 12 ++---
 .../apache/camel/component/bean/BeanComponent.java | 35 ++++++++++----
 .../apache/camel/component/bean/BeanEndpoint.java  | 49 ++++++++++++--------
 .../apache/camel/component/bean/BeanProcessor.java |  8 ++--
 .../apache/camel/component/bean/RegistryBean.java  |  4 +-
 .../camel/component/beanclass/ClassEndpoint.java   |  2 +-
 .../apache/camel/spring/config/errorHandler.xml    |  2 +-
 .../org/apache/camel/spi/BeanProcessorFactory.java |  4 +-
 .../org/apache/camel/model/BeanDefinition.java     | 25 ++++++++--
 .../apache/camel/model/ProcessorDefinition.java    | 54 ++++++++--------------
 .../java/org/apache/camel/reifier/BeanReifier.java |  6 +--
 .../org/apache/camel/reifier/ProcessorReifier.java |  1 -
 .../camel/component/bean/BeanEndpointTest.java     | 12 ++---
 .../camel/component/bean/BeanLifecycleTest.java    |  4 +-
 .../org/apache/camel/processor/BeanCachedTest.java |  1 +
 ...{BeanCachedTest.java => BeanSingletonTest.java} |  9 ++--
 .../runtimecatalog/impl/JSonSchemaHelperTest.java  |  9 ++--
 .../endpoint/dsl/BeanEndpointBuilderFactory.java   | 47 ++++++++++++++++---
 .../endpoint/dsl/ClassEndpointBuilderFactory.java  | 51 ++++++++++++++++----
 .../modules/ROOT/pages/camel-3x-upgrade-guide.adoc |  9 ++++
 22 files changed, 236 insertions(+), 128 deletions(-)

diff --git a/components/camel-bean/src/main/docs/bean-component.adoc b/components/camel-bean/src/main/docs/bean-component.adoc
index dbf6d3b..389a924 100644
--- a/components/camel-bean/src/main/docs/bean-component.adoc
+++ b/components/camel-bean/src/main/docs/bean-component.adoc
@@ -23,14 +23,15 @@ the Registry
 
 
 // component options: START
-The Bean component supports 4 options, which are listed below.
+The Bean component supports 5 options, which are listed below.
 
 
 
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
-| *cache* (advanced) | If enabled, Camel will cache the result of the first Registry look-up. Cache can be enabled if the bean in the Registry is defined as a singleton scope. |  | Boolean
+| *cache* (producer) | *Deprecated* Use singleton option instead. | true | Boolean
+| *singleton* (producer) | Whether to use singleton scoped beans. If enabled then the bean is created or looked up once and reused (the bean should be thread-safe). Setting this to false will let Camel create/lookup a new bean instance, per use; which acts as prototype scoped. However beware that if you lookup the bean, then the registry that holds the bean, would return a bean accordingly to its configuration, which can be singleton or prototype scoped. For example if you use Spring, or [...]
 | *basicPropertyBinding* (advanced) | Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | boolean
 | *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...]
 | *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean
@@ -58,15 +59,16 @@ with the following path and query parameters:
 |===
 
 
-=== Query Parameters (6 parameters):
+=== Query Parameters (7 parameters):
 
 
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
-| *cache* (common) | If enabled, Camel will cache the result of the first Registry look-up. Cache can be enabled if the bean in the Registry is defined as a singleton scope. |  | Boolean
+| *cache* (common) | *Deprecated* Use singleton option instead. |  | Boolean
 | *method* (common) | Sets the name of the method to invoke on the bean |  | String
 | *parameters* (common) | Used for configuring additional properties on the bean |  | Map
+| *singleton* (common) | Whether to use singleton scoped beans. If enabled then the bean is created or looked up once and reused (the bean should be thread-safe). Setting this to false will let Camel create/lookup a new bean instance, per use; which acts as prototype scoped. However beware that if you lookup the bean, then the registry that holds the bean, would return a bean accordingly to its configuration, which can be singleton or prototype scoped. For example if you use Spring, or C [...]
 | *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...]
 | *basicPropertyBinding* (advanced) | Whether the endpoint should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | boolean
 | *synchronous* (advanced) | Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported). | false | boolean
diff --git a/components/camel-bean/src/main/docs/class-component.adoc b/components/camel-bean/src/main/docs/class-component.adoc
index ba2fb48..0e3fa66 100644
--- a/components/camel-bean/src/main/docs/class-component.adoc
+++ b/components/camel-bean/src/main/docs/class-component.adoc
@@ -26,14 +26,15 @@ bean.
 
 
 // component options: START
-The Class component supports 4 options, which are listed below.
+The Class component supports 5 options, which are listed below.
 
 
 
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
-| *cache* (advanced) | If enabled, Camel will cache the result of the first Registry look-up. Cache can be enabled if the bean in the Registry is defined as a singleton scope. |  | Boolean
+| *cache* (producer) | *Deprecated* Use singleton option instead. | true | Boolean
+| *singleton* (producer) | Whether to use singleton scoped beans. If enabled then the bean is created or looked up once and reused (the bean should be thread-safe). Setting this to false will let Camel create/lookup a new bean instance, per use; which acts as prototype scoped. However beware that if you lookup the bean, then the registry that holds the bean, would return a bean accordingly to its configuration, which can be singleton or prototype scoped. For example if you use Spring, or [...]
 | *basicPropertyBinding* (advanced) | Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | boolean
 | *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...]
 | *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean
@@ -61,15 +62,16 @@ with the following path and query parameters:
 |===
 
 
-=== Query Parameters (6 parameters):
+=== Query Parameters (7 parameters):
 
 
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
-| *cache* (common) | If enabled, Camel will cache the result of the first Registry look-up. Cache can be enabled if the bean in the Registry is defined as a singleton scope. |  | Boolean
+| *cache* (common) | *Deprecated* Use singleton option instead. |  | Boolean
 | *method* (common) | Sets the name of the method to invoke on the bean |  | String
 | *parameters* (common) | Used for configuring additional properties on the bean |  | Map
+| *singleton* (common) | Whether to use singleton scoped beans. If enabled then the bean is created or looked up once and reused (the bean should be thread-safe). Setting this to false will let Camel create/lookup a new bean instance, per use; which acts as prototype scoped. However beware that if you lookup the bean, then the registry that holds the bean, would return a bean accordingly to its configuration, which can be singleton or prototype scoped. For example if you use Spring, or C [...]
 | *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...]
 | *basicPropertyBinding* (advanced) | Whether the endpoint should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | boolean
 | *synchronous* (advanced) | Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported). | false | boolean
diff --git a/components/camel-bean/src/main/java/org/apache/camel/component/bean/AbstractBeanProcessor.java b/components/camel-bean/src/main/java/org/apache/camel/component/bean/AbstractBeanProcessor.java
index 7ac80a8..25b8ac7 100644
--- a/components/camel-bean/src/main/java/org/apache/camel/component/bean/AbstractBeanProcessor.java
+++ b/components/camel-bean/src/main/java/org/apache/camel/component/bean/AbstractBeanProcessor.java
@@ -35,7 +35,7 @@ public abstract class AbstractBeanProcessor extends AsyncProcessorSupport {
     private transient Processor processor;
     private transient boolean lookupProcessorDone;
     private final Object lock = new Object();
-    private Boolean cache;
+    private Boolean singleton;
     private String method;
     private boolean shorthandMethod;
 
@@ -88,7 +88,7 @@ public abstract class AbstractBeanProcessor extends AsyncProcessorSupport {
             Processor target = getProcessor();
             if (target == null) {
                 // only attempt to lookup the processor once or nearly once
-                boolean allowCache = cache == null || cache; // allow cache by default
+                boolean allowCache = singleton == null || singleton; // allow cache by default
                 if (allowCache) {
                     if (!lookupProcessorDone) {
                         synchronized (lock) {
@@ -167,12 +167,12 @@ public abstract class AbstractBeanProcessor extends AsyncProcessorSupport {
         return method;
     }
 
-    public Boolean getCache() {
-        return cache;
+    public Boolean getSingleton() {
+        return singleton;
     }
 
-    public void setCache(Boolean cache) {
-        this.cache = cache;
+    public void setSingleton(Boolean singleton) {
+        this.singleton = singleton;
     }
 
     /**
diff --git a/components/camel-bean/src/main/java/org/apache/camel/component/bean/BeanComponent.java b/components/camel-bean/src/main/java/org/apache/camel/component/bean/BeanComponent.java
index 5b27e1b..0d0a403 100644
--- a/components/camel-bean/src/main/java/org/apache/camel/component/bean/BeanComponent.java
+++ b/components/camel-bean/src/main/java/org/apache/camel/component/bean/BeanComponent.java
@@ -26,7 +26,7 @@ import org.apache.camel.support.LRUCacheFactory;
 import org.apache.camel.util.PropertiesHelper;
 
 /**
- * The <a href="http://camel.apache.org/bean.html">Bean Component</a> is for invoking Java beans from Camel.
+ * The Bean component is for invoking Java beans from Camel.
  */
 @org.apache.camel.spi.annotations.Component("bean")
 public class BeanComponent extends DefaultComponent {
@@ -36,9 +36,15 @@ public class BeanComponent extends DefaultComponent {
     @SuppressWarnings("unchecked")
     private final Map<BeanInfoCacheKey, BeanInfo> beanInfoCache = LRUCacheFactory.newLRUSoftCache(1000);
 
-    @Metadata(label = "advanced", description = "If enabled, Camel will cache the result of the first Registry look-up."
-        + " Cache can be enabled if the bean in the Registry is defined as a singleton scope.")
+    @Deprecated
+    @Metadata(defaultValue = "true", description = "Use singleton option instead.")
     private Boolean cache;
+    @Metadata(defaultValue = "true", description = "Whether to use singleton scoped beans. If enabled then the bean"
+            + " is created or looked up once and reused (the bean should be thread-safe). Setting this to false will let Camel create/lookup"
+            + " a new bean instance, per use; which acts as prototype scoped. However beware that if you lookup the bean, then the registry that holds the bean, would return "
+            + " a bean accordingly to its configuration, which can be singleton or prototype scoped. For example if you use Spring, or CDI, which"
+            + " has their own settings for setting bean scopes.")
+    private Boolean singleton = Boolean.TRUE;
 
     public BeanComponent() {
     }
@@ -49,7 +55,10 @@ public class BeanComponent extends DefaultComponent {
     protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
         BeanEndpoint endpoint = new BeanEndpoint(uri, this);
         endpoint.setBeanName(remaining);
-        endpoint.setCache(cache);
+        if (cache != null) {
+            endpoint.setCache(cache);
+        }
+        endpoint.setSingleton(singleton);
         setProperties(endpoint, parameters);
 
         // the bean.xxx options is for the bean
@@ -75,15 +84,21 @@ public class BeanComponent extends DefaultComponent {
         beanInfoCache.clear();
     }
 
+    @Deprecated
     public Boolean getCache() {
-        return cache;
+        return singleton;
     }
 
-    /**
-     * If enabled, Camel will cache the result of the first Registry look-up.
-     * Cache can be enabled if the bean in the Registry is defined as a singleton scope.
-     */
+    @Deprecated
     public void setCache(Boolean cache) {
-        this.cache = cache;
+        this.singleton = cache;
+    }
+
+    public Boolean getSingleton() {
+        return singleton;
+    }
+
+    public void setSingleton(Boolean singleton) {
+        this.singleton = singleton;
     }
 }
diff --git a/components/camel-bean/src/main/java/org/apache/camel/component/bean/BeanEndpoint.java b/components/camel-bean/src/main/java/org/apache/camel/component/bean/BeanEndpoint.java
index 8ceac11..0e3b954 100644
--- a/components/camel-bean/src/main/java/org/apache/camel/component/bean/BeanEndpoint.java
+++ b/components/camel-bean/src/main/java/org/apache/camel/component/bean/BeanEndpoint.java
@@ -40,9 +40,15 @@ public class BeanEndpoint extends DefaultEndpoint {
     private String beanName;
     @UriParam(label = "common", description = "Sets the name of the method to invoke on the bean")
     private String method;
-    @UriParam(label = "common", description = "If enabled, Camel will cache the result of the first Registry look-up."
-            + " Cache can be enabled if the bean in the Registry is defined as a singleton scope.")
+    @Deprecated
+    @UriParam(label = "common", description = "Use singleton option instead.")
     private Boolean cache;
+    @UriParam(label = "common", defaultValue = "true", description = "Whether to use singleton scoped beans. If enabled then the bean"
+            + " is created or looked up once and reused (the bean should be thread-safe). Setting this to false will let Camel create/lookup"
+            + " a new bean instance, per use; which acts as prototype scoped. However beware that if you lookup the bean, then the registry that holds the bean, would return "
+            + " a bean accordingly to its configuration, which can be singleton or prototype scoped. For example if you use Spring, or CDI, which"
+            + " has their own settings for setting bean scopes.")
+    private Boolean singleton = Boolean.TRUE;
     @UriParam(prefix = "bean.", label = "common", description = "Used for configuring additional properties on the bean", multiValue = true)
     private Map<String, Object> parameters;
 
@@ -83,7 +89,8 @@ public class BeanEndpoint extends DefaultEndpoint {
             BeanHolder holder = getBeanHolder();
             if (holder == null) {
                 RegistryBean registryBean = new RegistryBean(getCamelContext(), beanName);
-                if (isCache()) {
+                if (isSingleton()) {
+                    // if singleton then create a cached holder that use the same singleton instance
                     holder = registryBean.createCacheHolder();
                 } else {
                     holder = registryBean;
@@ -93,7 +100,7 @@ public class BeanEndpoint extends DefaultEndpoint {
             if (method != null) {
                 processor.setMethod(method);
             }
-            processor.setCache(cache);
+            processor.setSingleton(singleton);
             if (parameters != null) {
                 setProperties(processor, parameters);
             }
@@ -113,36 +120,41 @@ public class BeanEndpoint extends DefaultEndpoint {
         return beanName;
     }
 
-    /**
-     * Sets the name of the bean to invoke
-     */
     public void setBeanName(String beanName) {
         this.beanName = beanName;
     }
 
+    @Deprecated
     public boolean isCache() {
-        return cache != null ? cache : false;
+        return isSingleton();
     }
 
+    @Deprecated
     public Boolean getCache() {
-        return cache;
+        return getSingleton();
     }
 
-    /**
-     * If enabled, Camel will cache the result of the first Registry look-up.
-     * Cache can be enabled if the bean in the Registry is defined as a singleton scope.
-     */
+    @Deprecated
     public void setCache(Boolean cache) {
-        this.cache = cache;
+        setSingleton(cache);
+    }
+
+    public boolean isSingleton() {
+        return singleton != null ? singleton : false;
+    }
+
+    public Boolean getSingleton() {
+        return singleton;
+    }
+
+    public void setSingleton(Boolean singleton) {
+        this.singleton = singleton;
     }
 
     public String getMethod() {
         return method;
     }
 
-    /**
-     * Sets the name of the method to invoke on the bean
-     */
     public void setMethod(String method) {
         this.method = method;
     }
@@ -159,9 +171,6 @@ public class BeanEndpoint extends DefaultEndpoint {
         return parameters;
     }
 
-    /**
-     * Used for configuring additional properties on the bean
-     */
     public void setParameters(Map<String, Object> parameters) {
         this.parameters = parameters;
     }
diff --git a/components/camel-bean/src/main/java/org/apache/camel/component/bean/BeanProcessor.java b/components/camel-bean/src/main/java/org/apache/camel/component/bean/BeanProcessor.java
index b545deb..b9ad238 100644
--- a/components/camel-bean/src/main/java/org/apache/camel/component/bean/BeanProcessor.java
+++ b/components/camel-bean/src/main/java/org/apache/camel/component/bean/BeanProcessor.java
@@ -76,12 +76,12 @@ public class BeanProcessor extends ServiceSupport implements AsyncProcessor {
         return delegate.getMethod();
     }
 
-    public Boolean getCache() {
-        return delegate.getCache();
+    public Boolean getSingleton() {
+        return delegate.getSingleton();
     }
 
-    public void setCache(Boolean cache) {
-        delegate.setCache(cache);
+    public void setSingleton(Boolean singleton) {
+        delegate.setSingleton(singleton);
     }
 
     public void setMethod(String method) {
diff --git a/components/camel-bean/src/main/java/org/apache/camel/component/bean/RegistryBean.java b/components/camel-bean/src/main/java/org/apache/camel/component/bean/RegistryBean.java
index b871c8f..e4f29cf 100644
--- a/components/camel-bean/src/main/java/org/apache/camel/component/bean/RegistryBean.java
+++ b/components/camel-bean/src/main/java/org/apache/camel/component/bean/RegistryBean.java
@@ -59,9 +59,7 @@ public class RegistryBean implements BeanHolder {
     }
 
     /**
-     * Creates a cached and constant {@link org.apache.camel.component.bean.BeanHolder} from this holder.
-     *
-     * @return a new {@link org.apache.camel.component.bean.BeanHolder} that has cached the lookup of the bean.
+     * Creates a singleton (cached and constant) {@link org.apache.camel.component.bean.BeanHolder} from this holder.
      */
     public ConstantBeanHolder createCacheHolder() {
         Object bean = getBean();
diff --git a/components/camel-bean/src/main/java/org/apache/camel/component/beanclass/ClassEndpoint.java b/components/camel-bean/src/main/java/org/apache/camel/component/beanclass/ClassEndpoint.java
index 508d61a..5f85a65 100644
--- a/components/camel-bean/src/main/java/org/apache/camel/component/beanclass/ClassEndpoint.java
+++ b/components/camel-bean/src/main/java/org/apache/camel/component/beanclass/ClassEndpoint.java
@@ -21,7 +21,7 @@ import org.apache.camel.component.bean.BeanEndpoint;
 import org.apache.camel.spi.UriEndpoint;
 
 /**
- * The <a href="http://camel.apache.org/class.html">class component</a> is for invoking Java classes (Java beans) from Camel.
+ * The Class component is for invoking Java classes (Java beans) from Camel.
  */
 @UriEndpoint(firstVersion = "2.4.0", scheme = "class", title = "Class", syntax = "class:beanName", producerOnly = true, label = "core,java")
 public class ClassEndpoint extends BeanEndpoint {
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/config/errorHandler.xml b/components/camel-spring/src/test/resources/org/apache/camel/spring/config/errorHandler.xml
index 6fef7a0..17d9b80 100644
--- a/components/camel-spring/src/test/resources/org/apache/camel/spring/config/errorHandler.xml
+++ b/components/camel-spring/src/test/resources/org/apache/camel/spring/config/errorHandler.xml
@@ -38,7 +38,7 @@
     </camelContext>
 
     <bean id="deadLetterErrorHandler" class="org.apache.camel.builder.DeadLetterChannelBuilder">
-        <property name="deadLetterUri" value="bean:exceptionProcessor"/>
+        <property name="deadLetterUri" value="mock:exceptionProcessor"/>
         <property name="redeliveryPolicy" ref="rsRedeliveryPolicyConfig"/>
     </bean>
 
diff --git a/core/camel-api/src/main/java/org/apache/camel/spi/BeanProcessorFactory.java b/core/camel-api/src/main/java/org/apache/camel/spi/BeanProcessorFactory.java
index aa6e7f0..1de2b82 100644
--- a/core/camel-api/src/main/java/org/apache/camel/spi/BeanProcessorFactory.java
+++ b/core/camel-api/src/main/java/org/apache/camel/spi/BeanProcessorFactory.java
@@ -50,10 +50,10 @@ public interface BeanProcessorFactory {
      * @param beanClass     or the bean class
      * @param ref           or bean reference to lookup the bean from the registry
      * @param method        optional name of method to invoke
-     * @param cacheBean    whether to cache lookup up the bean
+     * @param singleton     whether to use singleton scoped bean
      * @return the created processor
      * @throws Exception is thrown if error creating the processor
      */
     Processor createBeanProcessor(CamelContext camelContext, Object bean, String beanType, Class<?> beanClass, String ref,
-                                         String method, boolean cacheBean) throws Exception;
+                                         String method, boolean singleton) throws Exception;
 }
diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/model/BeanDefinition.java b/core/camel-core-engine/src/main/java/org/apache/camel/model/BeanDefinition.java
index 701497c..00b3c20 100644
--- a/core/camel-core-engine/src/main/java/org/apache/camel/model/BeanDefinition.java
+++ b/core/camel-core-engine/src/main/java/org/apache/camel/model/BeanDefinition.java
@@ -40,7 +40,11 @@ public class BeanDefinition extends NoOutputDefinition<BeanDefinition> {
     private String beanType;
     @XmlAttribute
     @Metadata(defaultValue = "true", javaType = "java.lang.Boolean")
+    @Deprecated
     private String cache;
+    @XmlAttribute
+    @Metadata(defaultValue = "true", javaType = "java.lang.Boolean")
+    private String singleton;
     @XmlTransient
     private Class<?> beanClass;
     @XmlTransient
@@ -147,14 +151,29 @@ public class BeanDefinition extends NoOutputDefinition<BeanDefinition> {
     }
 
     public String getCache() {
-        return cache;
+        return getSingleton();
     }
 
     /**
-     * Caches the bean lookup, to avoid lookup up bean on every usage.
+     * Use singleton option instead
      */
     public void setCache(String cache) {
-        this.cache = cache;
+        setSingleton(cache);
+    }
+
+    public String getSingleton() {
+        return singleton;
+    }
+
+    /**
+     * Whether to use singleton scoped beans. If enabled then the bean is created or looked up once and reused (the bean should be thread-safe).
+     * Setting this to false will let Camel create/lookup a new bean instance, per use; which acts as prototype scoped.
+     * However beware that if you lookup the bean, then the registry that holds the bean, would return a bean
+     * accordingly to its configuration, which can be singleton or prototype scoped.
+     * For example if you use Spring, or CDI, which has their own settings for setting bean scopes.
+     */
+    public void setSingleton(String singleton) {
+        this.singleton = singleton;
     }
 
     // Fluent API
diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/model/ProcessorDefinition.java b/core/camel-core-engine/src/main/java/org/apache/camel/model/ProcessorDefinition.java
index 5535384..7c67196 100644
--- a/core/camel-core-engine/src/main/java/org/apache/camel/model/ProcessorDefinition.java
+++ b/core/camel-core-engine/src/main/java/org/apache/camel/model/ProcessorDefinition.java
@@ -2499,10 +2499,8 @@ public abstract class ProcessorDefinition<Type extends ProcessorDefinition<Type>
      * Translator EIP:</a> Adds a bean which is invoked which could be a final
      * destination, or could be a transformation in a pipeline
      *
-     * @param bean the bean to invoke, or a reference to a bean if the type is a
-     *            String
-     * @param method the method name to invoke on the bean (can be used to avoid
-     *            ambiguity)
+     * @param bean the bean to invoke, or a reference to a bean if the type is a String
+     * @param method the method name to invoke on the bean (can be used to avoid ambiguity)
      * @return the builder
      */
     public Type bean(Supplier<Object> bean, String method) {
@@ -2514,21 +2512,18 @@ public abstract class ProcessorDefinition<Type extends ProcessorDefinition<Type>
      * Translator EIP:</a> Adds a bean which is invoked which could be a final
      * destination, or could be a transformation in a pipeline
      *
-     * @param bean the bean to invoke, or a reference to a bean if the type is a
-     *            String
-     * @param cache if enabled, Camel will cache the result of the first
-     *            Registry look-up. Cache can be enabled if the bean in the
-     *            Registry is defined as a singleton scope. the multi parameter
+     * @param bean the bean to invoke, or a reference to a bean if the type is a String
+     * @param singleton whether to use singleton scoped beans, or not
      * @return the builder
      */
-    public Type bean(Object bean, boolean cache) {
+    public Type bean(Object bean, boolean singleton) {
         BeanDefinition answer = new BeanDefinition();
         if (bean instanceof String) {
             answer.setRef((String)bean);
         } else {
             answer.setBean(bean);
         }
-        answer.setCache(Boolean.toString(cache));
+        answer.setSingleton(Boolean.toString(singleton));
         addOutput(answer);
         return asType();
     }
@@ -2538,16 +2533,12 @@ public abstract class ProcessorDefinition<Type extends ProcessorDefinition<Type>
      * Translator EIP:</a> Adds a bean which is invoked which could be a final
      * destination, or could be a transformation in a pipeline
      *
-     * @param bean the bean to invoke, or a reference to a bean if the type is a
-     *            String
-     * @param method the method name to invoke on the bean (can be used to avoid
-     *            ambiguity)
-     * @param cache if enabled, Camel will cache the result of the first
-     *            Registry look-up. Cache can be enabled if the bean in the
-     *            Registry is defined as a singleton scope. the multi parameter
+     * @param bean the bean to invoke, or a reference to a bean if the type is a String
+     * @param method the method name to invoke on the bean (can be used to avoid ambiguity)
+     * @param singleton whether to use singleton scoped beans, or not
      * @return the builder
      */
-    public Type bean(Object bean, String method, boolean cache) {
+    public Type bean(Object bean, String method, boolean singleton) {
         BeanDefinition answer = new BeanDefinition();
         if (bean instanceof String) {
             answer.setRef((String)bean);
@@ -2555,7 +2546,7 @@ public abstract class ProcessorDefinition<Type extends ProcessorDefinition<Type>
             answer.setBean(bean);
         }
         answer.setMethod(method);
-        answer.setCache(Boolean.toString(cache));
+        answer.setSingleton(Boolean.toString(singleton));
         addOutput(answer);
         return asType();
     }
@@ -2565,8 +2556,7 @@ public abstract class ProcessorDefinition<Type extends ProcessorDefinition<Type>
      * Translator EIP:</a> Adds a bean which is invoked which could be a final
      * destination, or could be a transformation in a pipeline
      *
-     * @param beanType the bean class, Camel will instantiate an object at
-     *            runtime
+     * @param beanType the bean class, Camel will instantiate an object at runtime
      * @return the builder
      */
     public Type bean(Class<?> beanType) {
@@ -2581,10 +2571,8 @@ public abstract class ProcessorDefinition<Type extends ProcessorDefinition<Type>
      * Translator EIP:</a> Adds a bean which is invoked which could be a final
      * destination, or could be a transformation in a pipeline
      *
-     * @param beanType the bean class, Camel will instantiate an object at
-     *            runtime
-     * @param method the method name to invoke on the bean (can be used to avoid
-     *            ambiguity)
+     * @param beanType the bean class, Camel will instantiate an object at runtime
+     * @param method the method name to invoke on the bean (can be used to avoid ambiguity)
      * @return the builder
      */
     public Type bean(Class<?> beanType, String method) {
@@ -2600,20 +2588,16 @@ public abstract class ProcessorDefinition<Type extends ProcessorDefinition<Type>
      * Translator EIP:</a> Adds a bean which is invoked which could be a final
      * destination, or could be a transformation in a pipeline
      *
-     * @param beanType the bean class, Camel will instantiate an object at
-     *            runtime
-     * @param method the method name to invoke on the bean (can be used to avoid
-     *            ambiguity)
-     * @param cache if enabled, Camel will cache the result of the first
-     *            Registry look-up. Cache can be enabled if the bean in the
-     *            Registry is defined as a singleton scope. the multi parameter
+     * @param beanType the bean class, Camel will instantiate an object at runtime
+     * @param method the method name to invoke on the bean (can be used to avoid ambiguity)
+     * @param singleton whether to use singleton scoped beans, or not
      * @return the builder
      */
-    public Type bean(Class<?> beanType, String method, boolean cache) {
+    public Type bean(Class<?> beanType, String method, boolean singleton) {
         BeanDefinition answer = new BeanDefinition();
         answer.setBeanType(beanType);
         answer.setMethod(method);
-        answer.setCache(Boolean.toString(cache));
+        answer.setSingleton(Boolean.toString(singleton));
         addOutput(answer);
         return asType();
     }
diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/reifier/BeanReifier.java b/core/camel-core-engine/src/main/java/org/apache/camel/reifier/BeanReifier.java
index e7db558..7fac849 100644
--- a/core/camel-core-engine/src/main/java/org/apache/camel/reifier/BeanReifier.java
+++ b/core/camel-core-engine/src/main/java/org/apache/camel/reifier/BeanReifier.java
@@ -44,11 +44,11 @@ public class BeanReifier extends ProcessorReifier<BeanDefinition> {
         if (fac == null) {
             throw new IllegalStateException("Cannot find BeanProcessorFactory. Make sure camel-bean is on the classpath.");
         }
-        return fac.createBeanProcessor(camelContext, bean, beanType, beanClass, ref, method, isCacheBean());
+        return fac.createBeanProcessor(camelContext, bean, beanType, beanClass, ref, method, isSingletonBean());
     }
 
-    private boolean isCacheBean() {
-        return definition.getCache() == null || Boolean.parseBoolean(definition.getCache());
+    private boolean isSingletonBean() {
+        return definition.getSingleton() == null || Boolean.parseBoolean(definition.getSingleton());
     }
 
 }
diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/reifier/ProcessorReifier.java b/core/camel-core-engine/src/main/java/org/apache/camel/reifier/ProcessorReifier.java
index d831188..a2b7cd3 100644
--- a/core/camel-core-engine/src/main/java/org/apache/camel/reifier/ProcessorReifier.java
+++ b/core/camel-core-engine/src/main/java/org/apache/camel/reifier/ProcessorReifier.java
@@ -27,7 +27,6 @@ import org.apache.camel.Channel;
 import org.apache.camel.ErrorHandlerFactory;
 import org.apache.camel.ExtendedCamelContext;
 import org.apache.camel.Processor;
-import org.apache.camel.RouteAware;
 import org.apache.camel.model.AggregateDefinition;
 import org.apache.camel.model.BeanDefinition;
 import org.apache.camel.model.CatchDefinition;
diff --git a/core/camel-core/src/test/java/org/apache/camel/component/bean/BeanEndpointTest.java b/core/camel-core/src/test/java/org/apache/camel/component/bean/BeanEndpointTest.java
index bb4c44e..06750b7 100644
--- a/core/camel-core/src/test/java/org/apache/camel/component/bean/BeanEndpointTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/component/bean/BeanEndpointTest.java
@@ -44,7 +44,7 @@ public class BeanEndpointTest extends ContextTestSupport {
         endpoint.setBeanName("foo");
         assertEquals("foo", endpoint.getBeanName());
 
-        assertEquals(false, endpoint.isCache());
+        assertEquals(true, endpoint.isSingleton());
         assertNull(endpoint.getBeanHolder());
         assertNull(endpoint.getMethod());
         assertEquals("bean:foo", endpoint.getEndpointUri());
@@ -70,7 +70,7 @@ public class BeanEndpointTest extends ContextTestSupport {
         endpoint.setBeanName("foo");
         assertEquals("foo", endpoint.getBeanName());
 
-        assertEquals(false, endpoint.isCache());
+        assertEquals(true, endpoint.isSingleton());
         assertNull(endpoint.getBeanHolder());
         assertNull(endpoint.getMethod());
         assertEquals("bean:foo", endpoint.getEndpointUri());
@@ -98,7 +98,7 @@ public class BeanEndpointTest extends ContextTestSupport {
         endpoint.setBeanName("foo");
         assertEquals("foo", endpoint.getBeanName());
 
-        assertEquals(false, endpoint.isCache());
+        assertEquals(true, endpoint.isSingleton());
         assertNull(endpoint.getBeanHolder());
         assertNull(endpoint.getMethod());
         assertEquals("bean:foo", endpoint.getEndpointUri());
@@ -124,7 +124,7 @@ public class BeanEndpointTest extends ContextTestSupport {
         endpoint.setMethod("hello");
         assertEquals("foo", endpoint.getBeanName());
 
-        assertEquals(false, endpoint.isCache());
+        assertEquals(true, endpoint.isSingleton());
         assertNull(endpoint.getBeanHolder());
         assertEquals("hello", endpoint.getMethod());
         assertEquals("bean:foo?method=hello", endpoint.getEndpointUri());
@@ -151,7 +151,7 @@ public class BeanEndpointTest extends ContextTestSupport {
         endpoint.setMethod("hello");
         assertEquals("foo", endpoint.getBeanName());
 
-        assertEquals(true, endpoint.isCache());
+        assertEquals(true, endpoint.isSingleton());
         assertNull(endpoint.getBeanHolder());
         assertEquals("hello", endpoint.getMethod());
         assertEquals("bean:foo?method=hello", endpoint.getEndpointUri());
@@ -179,7 +179,7 @@ public class BeanEndpointTest extends ContextTestSupport {
         BeanHolder holder = new RegistryBean(context, "foo");
         endpoint.setBeanHolder(holder);
 
-        assertEquals(false, endpoint.isCache());
+        assertEquals(true, endpoint.isSingleton());
         assertEquals(holder, endpoint.getBeanHolder());
 
         context.addRoutes(new RouteBuilder() {
diff --git a/core/camel-core/src/test/java/org/apache/camel/component/bean/BeanLifecycleTest.java b/core/camel-core/src/test/java/org/apache/camel/component/bean/BeanLifecycleTest.java
index f7674cb..6154056 100644
--- a/core/camel-core/src/test/java/org/apache/camel/component/bean/BeanLifecycleTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/component/bean/BeanLifecycleTest.java
@@ -83,9 +83,9 @@ public class BeanLifecycleTest extends ContextTestSupport {
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                from("direct:foo").routeId("foo").bean(statefulInstance, "doSomething").bean(MyStatefulBean.class, "doSomething")
+                from("direct:foo").routeId("foo").bean(statefulInstance, "doSomething", false).bean(MyStatefulBean.class, "doSomething")
                     .bean(MyStatefulBean.class.getName(), "doSomething", true).bean(MyStatelessBean.class.getName(), "doSomething", false)
-                    .to("bean:statefulInstanceInRegistry?method=doSomething&cache=true").to("bean:statefulInstanceInRegistryNoCache?method=doSomething&cache=false")
+                    .to("bean:statefulInstanceInRegistry?method=doSomething&singleton=true").to("bean:statefulInstanceInRegistryNoCache?method=doSomething&singleton=false")
                     .to("mock:result");
             }
         };
diff --git a/core/camel-core/src/test/java/org/apache/camel/processor/BeanCachedTest.java b/core/camel-core/src/test/java/org/apache/camel/processor/BeanCachedTest.java
index 69ef1e6..9f1e053 100644
--- a/core/camel-core/src/test/java/org/apache/camel/processor/BeanCachedTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/processor/BeanCachedTest.java
@@ -25,6 +25,7 @@ import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.impl.JndiRegistry;
 import org.junit.Test;
 
+@Deprecated
 public class BeanCachedTest extends ContextTestSupport {
 
     private Context context;
diff --git a/core/camel-core/src/test/java/org/apache/camel/processor/BeanCachedTest.java b/core/camel-core/src/test/java/org/apache/camel/processor/BeanSingletonTest.java
similarity index 92%
copy from core/camel-core/src/test/java/org/apache/camel/processor/BeanCachedTest.java
copy to core/camel-core/src/test/java/org/apache/camel/processor/BeanSingletonTest.java
index 69ef1e6..b5104be 100644
--- a/core/camel-core/src/test/java/org/apache/camel/processor/BeanCachedTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/processor/BeanSingletonTest.java
@@ -25,7 +25,7 @@ import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.impl.JndiRegistry;
 import org.junit.Test;
 
-public class BeanCachedTest extends ContextTestSupport {
+public class BeanSingletonTest extends ContextTestSupport {
 
     private Context context;
 
@@ -36,9 +36,8 @@ public class BeanCachedTest extends ContextTestSupport {
         return new RouteBuilder() {
             @Override
             public void configure() {
-                from("direct:noCache").to("bean:something?cache=false");
-                from("direct:cached").to("bean:something?cache=true");
-
+                from("direct:noCache").to("bean:something?singleton=false");
+                from("direct:cached").to("bean:something?singleton=true");
             }
         };
     }
@@ -65,7 +64,7 @@ public class BeanCachedTest extends ContextTestSupport {
     }
 
     @Test
-    public void testBeanWithCached() throws Exception {
+    public void testBeanWithSingleton() throws Exception {
         // Just make sure the bean processor doesn't work if the cached is false
         MyBean originalInstance = registry.lookupByNameAndType("something", MyBean.class);
         template.sendBody("direct:cached", null);
diff --git a/core/camel-core/src/test/java/org/apache/camel/runtimecatalog/impl/JSonSchemaHelperTest.java b/core/camel-core/src/test/java/org/apache/camel/runtimecatalog/impl/JSonSchemaHelperTest.java
index a9c3c44..b0d113f 100644
--- a/core/camel-core/src/test/java/org/apache/camel/runtimecatalog/impl/JSonSchemaHelperTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/runtimecatalog/impl/JSonSchemaHelperTest.java
@@ -54,14 +54,15 @@ public class JSonSchemaHelperTest extends ContextTestSupport {
         assertEquals("version", rows.get(16).keySet().iterator().next());
 
         rows = JSonSchemaHelper.parseJsonSchema("properties", json, true);
-        assertEquals(7, rows.size());
+        assertEquals(8, rows.size());
         assertEquals("beanName", rows.get(0).values().iterator().next());
         assertEquals("cache", rows.get(1).values().iterator().next());
         assertEquals("method", rows.get(2).values().iterator().next());
         assertEquals("parameters", rows.get(3).values().iterator().next());
-        assertEquals("lazyStartProducer", rows.get(4).values().iterator().next());
-        assertEquals("basicPropertyBinding", rows.get(5).values().iterator().next());
-        assertEquals("synchronous", rows.get(6).values().iterator().next());
+        assertEquals("singleton", rows.get(4).values().iterator().next());
+        assertEquals("lazyStartProducer", rows.get(5).values().iterator().next());
+        assertEquals("basicPropertyBinding", rows.get(6).values().iterator().next());
+        assertEquals("synchronous", rows.get(7).values().iterator().next());
     }
 
     @Test
diff --git a/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/BeanEndpointBuilderFactory.java b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/BeanEndpointBuilderFactory.java
index 2b2654b..471c756 100644
--- a/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/BeanEndpointBuilderFactory.java
+++ b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/BeanEndpointBuilderFactory.java
@@ -39,28 +39,26 @@ public interface BeanEndpointBuilderFactory {
             return (AdvancedBeanEndpointBuilder) this;
         }
         /**
-         * If enabled, Camel will cache the result of the first Registry
-         * look-up. Cache can be enabled if the bean in the Registry is defined
-         * as a singleton scope.
+         * Use singleton option instead.
          * 
          * The option is a: <code>java.lang.Boolean</code> type.
          * 
          * Group: common
          */
+        @Deprecated
         default BeanEndpointBuilder cache(Boolean cache) {
             doSetProperty("cache", cache);
             return this;
         }
         /**
-         * If enabled, Camel will cache the result of the first Registry
-         * look-up. Cache can be enabled if the bean in the Registry is defined
-         * as a singleton scope.
+         * Use singleton option instead.
          * 
          * The option will be converted to a <code>java.lang.Boolean</code>
          * type.
          * 
          * Group: common
          */
+        @Deprecated
         default BeanEndpointBuilder cache(String cache) {
             doSetProperty("cache", cache);
             return this;
@@ -102,6 +100,43 @@ public interface BeanEndpointBuilderFactory {
             return this;
         }
         /**
+         * Whether to use singleton scoped beans. If enabled then the bean is
+         * created or looked up once and reused (the bean should be
+         * thread-safe). Setting this to false will let Camel create/lookup a
+         * new bean instance, per use; which acts as prototype scoped. However
+         * beware that if you lookup the bean, then the registry that holds the
+         * bean, would return a bean accordingly to its configuration, which can
+         * be singleton or prototype scoped. For example if you use Spring, or
+         * CDI, which has their own settings for setting bean scopes.
+         * 
+         * The option is a: <code>java.lang.Boolean</code> type.
+         * 
+         * Group: common
+         */
+        default BeanEndpointBuilder singleton(Boolean singleton) {
+            doSetProperty("singleton", singleton);
+            return this;
+        }
+        /**
+         * Whether to use singleton scoped beans. If enabled then the bean is
+         * created or looked up once and reused (the bean should be
+         * thread-safe). Setting this to false will let Camel create/lookup a
+         * new bean instance, per use; which acts as prototype scoped. However
+         * beware that if you lookup the bean, then the registry that holds the
+         * bean, would return a bean accordingly to its configuration, which can
+         * be singleton or prototype scoped. For example if you use Spring, or
+         * CDI, which has their own settings for setting bean scopes.
+         * 
+         * The option will be converted to a <code>java.lang.Boolean</code>
+         * type.
+         * 
+         * Group: common
+         */
+        default BeanEndpointBuilder singleton(String singleton) {
+            doSetProperty("singleton", singleton);
+            return this;
+        }
+        /**
          * Whether the producer should be started lazy (on the first message).
          * By starting lazy you can use this to allow CamelContext and routes to
          * startup in situations where a producer may otherwise fail during
diff --git a/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/ClassEndpointBuilderFactory.java b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/ClassEndpointBuilderFactory.java
index d8ed2bd..2718f10 100644
--- a/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/ClassEndpointBuilderFactory.java
+++ b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/ClassEndpointBuilderFactory.java
@@ -23,7 +23,7 @@ import org.apache.camel.builder.EndpointProducerBuilder;
 import org.apache.camel.builder.endpoint.AbstractEndpointBuilder;
 
 /**
- * The class component is for invoking Java classes (Java beans) from Camel.
+ * The Class component is for invoking Java classes (Java beans) from Camel.
  * 
  * Generated by camel-package-maven-plugin - do not edit this file!
  */
@@ -39,28 +39,26 @@ public interface ClassEndpointBuilderFactory {
             return (AdvancedClassEndpointBuilder) this;
         }
         /**
-         * If enabled, Camel will cache the result of the first Registry
-         * look-up. Cache can be enabled if the bean in the Registry is defined
-         * as a singleton scope.
+         * Use singleton option instead.
          * 
          * The option is a: <code>java.lang.Boolean</code> type.
          * 
          * Group: common
          */
+        @Deprecated
         default ClassEndpointBuilder cache(Boolean cache) {
             doSetProperty("cache", cache);
             return this;
         }
         /**
-         * If enabled, Camel will cache the result of the first Registry
-         * look-up. Cache can be enabled if the bean in the Registry is defined
-         * as a singleton scope.
+         * Use singleton option instead.
          * 
          * The option will be converted to a <code>java.lang.Boolean</code>
          * type.
          * 
          * Group: common
          */
+        @Deprecated
         default ClassEndpointBuilder cache(String cache) {
             doSetProperty("cache", cache);
             return this;
@@ -102,6 +100,43 @@ public interface ClassEndpointBuilderFactory {
             return this;
         }
         /**
+         * Whether to use singleton scoped beans. If enabled then the bean is
+         * created or looked up once and reused (the bean should be
+         * thread-safe). Setting this to false will let Camel create/lookup a
+         * new bean instance, per use; which acts as prototype scoped. However
+         * beware that if you lookup the bean, then the registry that holds the
+         * bean, would return a bean accordingly to its configuration, which can
+         * be singleton or prototype scoped. For example if you use Spring, or
+         * CDI, which has their own settings for setting bean scopes.
+         * 
+         * The option is a: <code>java.lang.Boolean</code> type.
+         * 
+         * Group: common
+         */
+        default ClassEndpointBuilder singleton(Boolean singleton) {
+            doSetProperty("singleton", singleton);
+            return this;
+        }
+        /**
+         * Whether to use singleton scoped beans. If enabled then the bean is
+         * created or looked up once and reused (the bean should be
+         * thread-safe). Setting this to false will let Camel create/lookup a
+         * new bean instance, per use; which acts as prototype scoped. However
+         * beware that if you lookup the bean, then the registry that holds the
+         * bean, would return a bean accordingly to its configuration, which can
+         * be singleton or prototype scoped. For example if you use Spring, or
+         * CDI, which has their own settings for setting bean scopes.
+         * 
+         * The option will be converted to a <code>java.lang.Boolean</code>
+         * type.
+         * 
+         * Group: common
+         */
+        default ClassEndpointBuilder singleton(String singleton) {
+            doSetProperty("singleton", singleton);
+            return this;
+        }
+        /**
          * Whether the producer should be started lazy (on the first message).
          * By starting lazy you can use this to allow CamelContext and routes to
          * startup in situations where a producer may otherwise fail during
@@ -203,7 +238,7 @@ public interface ClassEndpointBuilderFactory {
     }
     /**
      * Class (camel-bean)
-     * The class component is for invoking Java classes (Java beans) from Camel.
+     * The Class component is for invoking Java classes (Java beans) from Camel.
      * 
      * Category: core,java
      * Since: 2.4
diff --git a/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide.adoc b/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide.adoc
index 00599a2..448c138 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide.adoc
@@ -11,6 +11,15 @@ from both 3.0 to 3.1 and 3.1 to 3.2.
 
 == Upgrading Camel 3.0 to 3.1
 
+=== came-bean
+
+The bean component has been changed to behave as singleton scoped by default.
+This means that the bean is created or looked up once and reused.
+
+The option `cache` has been deprecated in favour of the new `singleton` option that by default is `true`. You can set this to `false` to use the old behaviour.
+
+NOTE: Setting this to false will let Camel create/lookup a new bean instance, per use; which acts as prototype scoped. However beware that if you lookup the bean, then the registry that holds the bean, would return a bean accordingly to its configuration, which can be singleton or prototype scoped. For example if you use Spring, or CDI, which has their own settings for setting bean scopes.
+
 === camel-nats
 
 The `camel-nats` component has changed its endpoint syntax from `nats:servers` to `nats:topic`.