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 2009/03/20 03:12:11 UTC

svn commit: r756306 - /camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java

Author: ningjiang
Date: Fri Mar 20 02:12:10 2009
New Revision: 756306

URL: http://svn.apache.org/viewvc?rev=756306&view=rev
Log:
CAMEL-1465 merge the patch to Camel-1.x branch

Modified:
    camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java

Modified: camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java?rev=756306&r1=756305&r2=756306&view=diff
==============================================================================
--- camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java (original)
+++ camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java Fri Mar 20 02:12:10 2009
@@ -28,6 +28,7 @@
 import org.apache.cxf.configuration.spring.ConfigurerImpl;
 import org.apache.cxf.message.Message;
 import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.AbstractApplicationContext;
 
 
 /**
@@ -65,7 +66,7 @@
             if (beanId.startsWith("//")) {
                 beanId = beanId.substring(2);
             }
-            SpringCamelContext context = (SpringCamelContext) this.getCamelContext();
+            SpringCamelContext context = (SpringCamelContext) this.getCamelContext();            
             configurer = new ConfigurerImpl(context.getApplicationContext());
             cxfEndpointBean = (CxfEndpointBean) context.getApplicationContext().getBean(beanId);
             ObjectHelper.notNull(cxfEndpointBean, "cxfEndpointBean");
@@ -190,6 +191,13 @@
     }
 
     public void configure(Object beanInstance) {
+        // check the ApplicationContext states first , and call the refresh if necessary
+        if (((SpringCamelContext)getCamelContext()).getApplicationContext() instanceof AbstractApplicationContext) {
+            AbstractApplicationContext context = (AbstractApplicationContext)((SpringCamelContext)getCamelContext()).getApplicationContext();
+            if (!context.isActive()) {
+                context.refresh();
+            }
+        }
         configurer.configureBean(beanId, beanInstance);
     }