svn commit: r935145 - /camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r935145 - /camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java

davsclaus-2
Author: davsclaus
Date: Sat Apr 17 08:11:42 2010
New Revision: 935145

URL: http://svn.apache.org/viewvc?rev=935145&view=rev
Log:
CAMEL-2650: Fixed issues when using @Produce on beans not enlisted in spring application context.

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

Modified: camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java?rev=935145&r1=935144&r2=935145&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java (original)
+++ camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java Sat Apr 17 08:11:42 2010
@@ -147,7 +147,13 @@ public class CamelBeanPostProcessor impl
             }
 
             protected boolean isSingleton(Object bean, String beanName) {
-                return applicationContext.isSingleton(beanName);
+                // no application context has been injected which means the bean
+                // has not been enlisted in Spring application context
+                if (applicationContext == null || beanName == null) {
+                    return super.isSingleton(bean, beanName);
+                } else {
+                    return applicationContext.isSingleton(beanName);
+                }
             }
 
             protected void startService(Service service, Object bean, String beanName) throws Exception {