Class CamelConfiguration
- java.lang.Object
-
- org.apache.camel.spring.javaconfig.CamelConfiguration
-
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanFactoryAware,org.springframework.context.ApplicationContextAware
- Direct Known Subclasses:
SingleRouteCamelConfiguration
@Configuration public abstract class CamelConfiguration extends Object implements org.springframework.beans.factory.BeanFactoryAware, org.springframework.context.ApplicationContextAware
A useful base class for writing Spring annotation-based configurations for working with Camel.
-
-
Constructor Summary
Constructors Constructor Description CamelConfiguration()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.camel.spring.CamelBeanPostProcessorcamelBeanPostProcessor()Camel post processor - required to support Camel annotations.org.apache.camel.CamelContextcamelContext()Get's theCamelContextto be used.org.apache.camel.ConsumerTemplateconsumerTemplate(org.apache.camel.CamelContext camelContext)Get's theConsumerTemplateto be used.protected org.apache.camel.CamelContextcreateCamelContext()Factory method returningCamelContextused by this configuration.protected org.springframework.context.ApplicationContextgetApplicationContext()<T> TgetBean(Class<T> type)ObjectgetBean(String beanName)<T> TgetBean(String beanName, Class<T> type)protected org.springframework.beans.factory.BeanFactorygetBeanFactory()protected <T> TgetConfigured(T object)Invoke callbacks on the object, as though it were configured in the factory.org.apache.camel.ProducerTemplateproducerTemplate(org.apache.camel.CamelContext camelContext)Get's theProducerTemplateto be used.List<org.apache.camel.builder.RouteBuilder>routes()Returns the list of routes to use in this configuration.voidsetApplicationContext(org.springframework.context.ApplicationContext ac)voidsetBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)protected voidsetupCamelContext(org.apache.camel.CamelContext camelContext)Callback to setupCamelContextbefore its started
-
-
-
Method Detail
-
setBeanFactory
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
- Specified by:
setBeanFactoryin interfaceorg.springframework.beans.factory.BeanFactoryAware
-
getBeanFactory
protected org.springframework.beans.factory.BeanFactory getBeanFactory()
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext ac)
- Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware
-
getApplicationContext
protected org.springframework.context.ApplicationContext getApplicationContext()
-
getBean
public <T> T getBean(Class<T> type)
-
getConfigured
protected <T> T getConfigured(T object)
Invoke callbacks on the object, as though it were configured in the factory. If appropriate, the object may be wrapped before being returned. For this reason, it is recommended to always respect the return value when using this method.- Parameters:
object- object to configure- Returns:
- either the original object or a wrapped one after callbacks called on it.
-
producerTemplate
@Bean(initMethod="", destroyMethod="") public org.apache.camel.ProducerTemplate producerTemplate(org.apache.camel.CamelContext camelContext) throws ExceptionGet's theProducerTemplateto be used.- Throws:
Exception
-
consumerTemplate
@Bean(initMethod="", destroyMethod="") public org.apache.camel.ConsumerTemplate consumerTemplate(org.apache.camel.CamelContext camelContext) throws ExceptionGet's theConsumerTemplateto be used.- Throws:
Exception
-
camelBeanPostProcessor
@Bean public org.apache.camel.spring.CamelBeanPostProcessor camelBeanPostProcessor() throws ExceptionCamel post processor - required to support Camel annotations.- Throws:
Exception
-
camelContext
@Bean public org.apache.camel.CamelContext camelContext() throws ExceptionGet's theCamelContextto be used.- Throws:
Exception
-
setupCamelContext
protected void setupCamelContext(org.apache.camel.CamelContext camelContext) throws ExceptionCallback to setupCamelContextbefore its started- Throws:
Exception
-
createCamelContext
protected org.apache.camel.CamelContext createCamelContext() throws ExceptionFactory method returningCamelContextused by this configuration.- Returns:
CamelContextused by this configuration. By defaultSpringCamelContextinstance is created, to fully integrate Spring application context and Camel registry.- Throws:
Exception
-
routes
public List<org.apache.camel.builder.RouteBuilder> routes()
Returns the list of routes to use in this configuration. By default autowires allRouteBuilderinstances available in theApplicationContext.
-
-