Interface BeanProcessorFactory


public interface BeanProcessorFactory
Factory for creating a Processor that invokes a method on a bean with full support for Camel bean parameter bindings.

When a route contains a .bean() DSL call, Camel delegates processor creation to this factory. The factory implementation lives in camel-bean (loaded via the META-INF service file convention) and supports resolving the target bean from multiple sources: a direct instance, a registry reference by name, a class name, or a Class literal. The method parameter may be omitted to let Camel auto-select the best matching method using the bean-binding algorithm.

The scope parameter controls bean lifecycle: BeanScope.Singleton reuses one shared instance, while BeanScope.Prototype creates a new instance per exchange.

Since:
3.0
See Also:
  • Field Details

  • Method Details

    • createBeanProcessor

      Processor createBeanProcessor(CamelContext camelContext, Object bean, Method method) throws Exception
      Creates the bean processor from the existing bean instance
      Parameters:
      camelContext - the camel context
      bean - the bean
      method - the method to invoke
      Returns:
      the created processor
      Throws:
      Exception - is thrown if error creating the processor
    • createBeanProcessor

      Processor createBeanProcessor(CamelContext camelContext, @Nullable Object bean, @Nullable String beanType, @Nullable Class<?> beanClass, @Nullable String ref, @Nullable String method, BeanScope scope) throws Exception
      Creates the bean processor from a given set of parameters that can refer to the bean via an existing bean, a reference to a bean, or its class name etc.
      Parameters:
      camelContext - the camel context
      bean - the bean instance
      beanType - or the bean class name
      beanClass - or the bean class
      ref - or bean reference to look up the bean from the registry
      method - optional name of method to invoke
      scope - the scope of the bean
      Returns:
      the created processor
      Throws:
      Exception - is thrown if error creating the processor