Class BeanModelHelper

java.lang.Object
org.apache.camel.model.BeanModelHelper

public final class BeanModelHelper extends Object
Helper to create bean instances from bean model definitions.

Creating beans is complex as Camel support many options such as constructor, factory beans, builder beans, scripts, and much more. This helper hides this complexity for creating bean instances.

  • Method Details

    • newInstance

      public static Object newInstance(BeanFactoryDefinition def, org.apache.camel.CamelContext context) throws Exception
      Creates a new bean.
      Parameters:
      def - the bean model
      context - the camel context
      Returns:
      the created bean instance
      Throws:
      Exception - is thrown if error creating the bean
    • bind

      public static void bind(BeanFactoryDefinition<?> def, org.apache.camel.RouteTemplateContext routeTemplateContext) throws Exception
      Creates and binds the bean to the route-template repository (local beans for kamelets).
      Parameters:
      def - the bean factory to bind.
      routeTemplateContext - the context into which the bean factory should be bound.
      Throws:
      Exception - if an error occurs while trying to bind the bean factory