9 Replies Latest reply on Jan 5, 2017 6:21 AM by oliverweise

    Using @Bean and @Inject annotations in blueprint route

    salex

      Hi all.

       

      Is it possible to annotate a bean class with @Bean(...) and reference it from within a route in a blueprint.xml file? Furthermore, I like to inject other beans into that bean with @Inject annotation.

       

      I tried to get it running and always get a NoSuchComponentException exception.

       

      Anyway, I had to add the following bundle to deploy the whole thing.

      mvn:org.apache.aries.blueprint/org.apache.aries.blueprint.annotation.impl/1.0.1.fuse-71-047
      mvn:org.apache.aries.blueprint/org.apache.aries.blueprint.annotation.api/1.0.1.fuse-71-047
      mvn:org.apache.xbean/xbean-bundleutils/3.12
      mvn:org.apache.xbean/xbean-finder/3.12
      

       

      After that, the deployment resolved all dependencies, but when I try to access an annotated bean I get the aforementioned exception.

       

      The bean is annotated like this:

      @Bean(id="processor")
      public class Processor {
          @Inject(ref="blaServiceProxy")
          Bla blaService;
      ...
      

       

      and referenced in blueprint.xml:

      <camel:camelContext xmlns="http://camel.apache.org/schema/blueprint">
              <route id="start" autoStartup="true">
                  <from uri="jetty:http://0.0.0.0:9090/test"></from>
                  <to uri="bean:processor"></to>
      ...
      

       

      I'm working with FuseESBEnterprise-7.1.0.

       

      Regards,

      Alexander.

       

      Edited by: salex on Jan 15, 2013 1:14 PM

       

      Edited by: salex on Jan 15, 2013 1:15 PM