anchor.diff:  include::partial$component-endpoint-headers.adoc[]
   // component headers: END
   
  -== Using
  -
  -The object instance that is used to consume messages must be explicitly
  -registered with the Registry. For example, if you
  -are using Spring you must define the bean in the Spring configuration XML file.
  -
  -You can also register beans manually via Camel's `Registry` with the `bind` method.
  -
  -Once an endpoint has been registered, you can build Camel routes that
  -use it to process exchanges.
  +== Examples
   
   A *bean:* endpoint cannot be defined as the input to the route; i.e. you
   cannot consume from it, you can only route from some inbound message
  -Endpoint to the bean endpoint as output. So consider
  -using a *direct:* or *queue:* endpoint as the input.
  +Endpoint to the bean endpoint as output, such as the *direct* endpoint as input.
   
  -You can use the `createProxy()` methods on
  -https://www.javadoc.io/doc/org.apache.camel/camel-bean/current/org/apache/camel/component/bean/ProxyHelper.html[ProxyHelper]
  -to create a proxy that will generate exchanges and send them to any
  -endpoint:
  +Suppose you have the following POJO class to be used by Camel
   
  -And the same route using XML DSL:
  +[source,java]
  +----
  +package com.foo;
  +
  +public class MyBean {
  +
  +    public String saySomething(String input) {
  +        return "Hello " + input;
  +    }
  +}
  +----
  +
  +Then the bean can be called in a Camel route by the fully qualified classname:
  +
  +[source,java]
  +----
  +from("direct:hello")
  +   .to("bean:com.foo.MyBean");
  +----
  +
  +And in XML DSL:
   
   [source,xml]
   ----------------------------
   <route>
      <from uri="direct:hello"/>
  -   <to uri="bean:bye"/>
  +   <to uri="bean:com.foo.MyBean"/>
   </route>
   ----------------------------
   
  -== Bean as endpoint
  +What happens is that when the exchange is routed to the MyBean, then Camel
  +will use the Bean Binding to invoke the bean, in this case the _saySomethinh_ method,
  +by converting the `Exchange` in body to the `String`
  +type and storing the output of the method back to the Exchange again.
   
  -Camel also supports invoking xref:bean-component.adoc[Bean] as an Endpoint. In the
  -route below:
  +TIP: The bean component can also call a bean by _bean id_ by looking up the bean
  +in the xref:manual::registry.adoc[Registry] instead of using the class name.
   
  -What happens is that when the exchange is routed to the `myBean` Camel
  -will use the Bean Binding to invoke the bean. +
  - The source for the bean is just a plain POJO:
  -
  -Camel will use Bean Binding to invoke the
  -`sayHello` method, by converting the Exchange's In body to the `String`
  -type and storing the output of the method on the Exchange Out body.
  -
  -== Java DSL bean syntax
  +== Java DSL specific bean syntax
   
   Java DSL comes with syntactic sugar for the xref:bean-component.adoc[Bean]
   component. Instead of specifying the bean explicitly as the endpoint
  
positive.code: public interface ExampleInterface() {
      @Handler String methodName();
  }
  /* - - - - - - - - - - - */
  from("direct:start").bean((ExampleInterface) () -> ""))
  ---------------------------------------------------------------
  
  == Bean Binding
  
negative.code: -------------------------------------------------------
  
  Instead of passing name of the reference to the bean (so that Camel will
  lookup for it in the xref:manual::registry.adoc[Registry]), you can specify the bean itself:
  
  [source,java]
  ---------------------------------------------------------------
  