小编Igo*_*r P的帖子

通过org.osgi.service.component注释的抽象组件

我正在从org.apache.felix.scr注释迁移到org.osgi.service.component注释.我有一组继承自公共抽象类的组件.在felix的情况下,我可以在超类上使用@Component带有选项的注释componentAbstract=true,然后@Reference在超类中使用注释.我找不到如何将其迁移到osgi注释.

是否可以在Component的超类中使用Component注释?如果是这样,那么处理属性和元类型生成的适当方法是什么?

所以,我正在寻找的是这样的

/* No component definition should be generated for the parent, as it is
   abstract and cannot be instantiated */
@Component(property="parent.property=parentValue")
public abstract class Parent {
  @Reference
  protected Service aService;

  protected activate(Map<String,Object> props) {
    System.out.println("I have my parent property: "+props.get("parent.property"));

  @Override
  public abstract void doSomething();
}

/* For this class, the proper Component definition should be generated, also
   including the information coming from the annotations in the parent …
Run Code Online (Sandbox Code Playgroud)

osgi annotations maven-bundle-plugin

6
推荐指数
1
解决办法
2279
查看次数

标签 统计

annotations ×1

maven-bundle-plugin ×1

osgi ×1