org.apache.camel.spring.javaconfig
Class CamelConfiguration

java.lang.Object
  extended by org.apache.camel.spring.javaconfig.CamelConfiguration
All Implemented Interfaces:
BeanFactoryAware, ApplicationContextAware
Direct Known Subclasses:
SingleRouteCamelConfiguration

@Configuration
public abstract class CamelConfiguration
extends Object
implements BeanFactoryAware, ApplicationContextAware

A useful base class for writing Spring JavaConfig configurations for working with Camel

Version:
$Revision: 17114 $

Constructor Summary
CamelConfiguration()
           
 
Method Summary
 CamelBeanPostProcessor camelBeanPostProcessor()
           
 CamelContext camelContext()
          Returns the CamelContext
protected  CamelContext createCamelContext()
           
protected  ApplicationContext getApplicationContext()
           
<T> T
getBean(Class<T> type)
           
 Object getBean(String beanName)
           
<T> T
getBean(String beanName, Class<T> type)
           
protected  BeanFactory getBeanFactory()
           
protected
<T> T
getConfigured(T object)
          Invoke callbacks on the object, as though it were configured in the factory.
abstract  List<RouteBuilder> routes()
          Returns the list of routes to use in this configuration
 void setApplicationContext(ApplicationContext ac)
           
 void setBeanFactory(BeanFactory beanFactory)
           
protected  void setupCamelContext(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(BeanFactory beanFactory)
Specified by:
setBeanFactory in interface BeanFactoryAware

getBeanFactory

protected BeanFactory getBeanFactory()

setApplicationContext

public void setApplicationContext(ApplicationContext ac)
Specified by:
setApplicationContext in interface ApplicationContextAware

getApplicationContext

protected 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 CamelBeanPostProcessor camelBeanPostProcessor()
                                              throws Exception
Throws:
Exception

camelContext

@Bean
public CamelContext camelContext()
                          throws Exception
Returns the CamelContext

Throws:
Exception

setupCamelContext

protected void setupCamelContext(CamelContext camelContext)
                          throws Exception
Throws:
Exception

createCamelContext

protected CamelContext createCamelContext()
                                   throws Exception
Throws:
Exception

routes

public abstract List<RouteBuilder> routes()
Returns the list of routes to use in this configuration



Apache CAMEL