OSGi“立即= true”组件未激活

时间:2019-06-23 04:39:34

标签: java osgi

我正在尝试运行以下代码

@Component(name = "compname", immediate = true)
public class DemoComponent {

    private static Log log = LogFactory.getLog(DemoComponent.class);

    @Activate
    protected void activate(ComponentContext context) {

        try {
            //my code
        } catch (Exception e) {
            //catch
        }

        if (log.isDebugEnabled()) {
            log.debug("Demo component is activated ");
        }
    }
}

启动应用程序时,不会调用activate方法。我试过在try块内设置调试指针。同一项目中还有其他要激活的组件。

0 个答案:

没有答案