Hi William, Sorry , I don't realized about that. But CXFSpringEndpoint has the reference of the SpringCamelContext, I think it already introduce the dependency of the org.springframework.
I will go through the camel-cxf of 1.x branch to merge this change. Thanks, Willem William Tam wrote: > Hi Willem, > > Is it a good idea to import org.springframework packages from this > module? I thought it could create class not found problem when Spring > isn't in user's classpath (CxfComponent references CxfSpringEndpoint). > Should we merge fix to 1.x? > > Cheers, > William > > 2009/3/18 <[email protected]>: >> Author: ningjiang >> Date: Wed Mar 18 08:04:13 2009 >> New Revision: 755502 >> >> URL: http://svn.apache.org/viewvc?rev=755502&view=rev >> Log: >> CAMLE-1427 added the state check of the ApplicationContext state >> >> Modified: >> >> camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSpringEndpoint.java >> >> Modified: >> camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSpringEndpoint.java >> URL: >> http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSpringEndpoint.java?rev=755502&r1=755501&r2=755502&view=diff >> ============================================================================== >> --- >> camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSpringEndpoint.java >> (original) >> +++ >> camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSpringEndpoint.java >> Wed Mar 18 08:04:13 2009 >> @@ -19,6 +19,9 @@ >> import java.lang.reflect.Proxy; >> import javax.xml.namespace.QName; >> >> +import org.springframework.context.ApplicationContext; >> +import org.springframework.context.support.AbstractApplicationContext; >> + >> import org.apache.camel.CamelContext; >> import org.apache.camel.component.cxf.spring.CxfEndpointBean; >> import org.apache.camel.component.cxf.util.CxfEndpointUtils; >> @@ -60,8 +63,7 @@ >> >> >> private void init(CxfEndpointBean bean) throws Exception { >> - this.bean = bean; >> - >> + this.bean = bean; >> // create configurer >> configurer = new >> ConfigurerImpl(((SpringCamelContext)getCamelContext()) >> .getApplicationContext()); >> @@ -178,6 +180,13 @@ >> } >> >> 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); >> } >> >> >> >> >
