org.apache.camel.spring.javaconfig
Class CamelConfiguration

java.lang.Object
  extended by 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. Unless routes() method is overridden, this configuration automagically load all the RouteBuilder instances available in the Spring context.


Constructor Summary
CamelConfiguration()
           
 
Method Summary
 org.apache.camel.spring.CamelBeanPostProcessor camelBeanPostProcessor()
           
 org.apache.camel.CamelContext camelContext()
          Returns the CamelContext
protected  org.apache.camel.CamelContext createCamelContext()
          Factory method returning CamelContext used by this configuration.
protected  org.springframework.context.ApplicationContext getApplicationContext()
           
<T> T
getBean(Class<T> type)
           
 Object getBean(String beanName)
           
<T> T
getBean(String beanName, Class<T> type)
           
protected  org.springframework.beans.factory.BeanFactory getBeanFactory()
           
protected
<T> T
getConfigured(T object)
          Invoke callbacks on the object, as though it were configured in the factory.
 List<org.apache.camel.builder.RouteBuilder> routes()
          Returns the list of routes to use in this configuration.
 void setApplicationContext(org.springframework.context.ApplicationContext ac)
           
 void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
           
protected  void setupCamelContext(org.apache.camel.CamelContext camelContext)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CamelConfiguration

public CamelConfiguration()
Method Detail

setBeanFactory

public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
Specified by:
setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAware

getBeanFactory

protected org.springframework.beans.factory.BeanFactory getBeanFactory()

setApplicationContext

public void setApplicationContext(org.springframework.context.ApplicationContext ac)
Specified by:
setApplicationContext in interface org.springframework.context.ApplicationContextAware

getApplicationContext

protected org.springframework.context.ApplicationContext getApplicationContext()

getBean

public Object getBean(String beanName)

getBean

public <T> T getBean(Class<T> type)

getBean

public <T> T getBean(String beanName,
                     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.

camelBeanPostProcessor

@Bean
public org.apache.camel.spring.CamelBeanPostProcessor camelBeanPostProcessor()
                                                                      throws Exception
Throws:
Exception

camelContext

@Bean
public org.apache.camel.CamelContext camelContext()
                                           throws Exception
Returns the CamelContext

Throws:
Exception

setupCamelContext

protected void setupCamelContext(org.apache.camel.CamelContext camelContext)
                          throws Exception
Throws:
Exception

createCamelContext

protected org.apache.camel.CamelContext createCamelContext()
                                                    throws Exception
Factory method returning CamelContext used by this configuration.

Returns:
CamelContext used by this configuration. By default SpringCamelContext instance 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 all RouteBuilder instances available in the ApplicationContext.



Apache Camel