Waiting for active objects init

Hello,

I need to run a database setup task once the plugin is installed. For this I think I need to schedule a unique RUN_ONCE_PER_CLUSTER task. The problem is the task is running too soon and the active objects library is not initialised.

I read that I can use the LifecycleAware interface to wait for the active objects to be set up, but my onStart method is never called.

This is my class declaration:

@ExportAsService({XXX.class})
@Named("xxx")
public class XXXImpl implements XXX, LifecycleAware {
...
    @Override
    public void onStart() {
        if (!started) {
            bootup();
        }
    }
...

Am I missing something?

The answer seems to be that the LifecycleAware interface must also be specified in the ExportAsService annotation, for some reason…

@ExportAsService({XXX.class, LifecycleAware.class})
@Named("xxx")
public class XXXImpl implements XXX, LifecycleAware {
...
    @Override
    public void onStart() {
        if (!started) {
            bootup();
        }
    }
...