Annotation Interface ComponentImport


@Target({PARAMETER,ANNOTATION_TYPE,FIELD}) @Retention(RUNTIME) public @interface ComponentImport
Annotation representing an OSGi service that's required to be imported into this bundle. Can be applied to constructor params where the param type is a service interface exported by another bundle
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Override the default spring bean name to assign within this plugin for the imported OSGi service.
  • Element Details

    • value

      String value
      Override the default spring bean name to assign within this plugin for the imported OSGi service. Not usually needed.

      The default is to use the imported interface name with the first character lowercased, e.g. this code will result in a bean name of contentService:

      
       @Named
       public class MyComponent {
           @Inject
           public MyComponent(@ComponentImport ContentService myExternalService) {
               // more stuff here
           }
       }
       
      So you only need to set this if you want to override the default: e.g. if you're importing two services with the same classname from different packages, you need to set different names for them; or if you need specific bean names to use with @Qualifier("yourBeanName").

      This name is local to this plugin's spring context; it's unrelated to the name of the bean (inside the product's or the providing plugin's spring context) that's exporting the service we're importing.

      Default:
      ""