Looking for Cloud Services or Professional Support? Check restheart.com

Edit Page

Initializers

An Initializer allows executing custom logic at startup time.

The Initializer class

An Initializer consists of a class implementing the Initializer interface annotated with @RegisterPlugin.

The following Initializer hangs restheart startup until the user confirms:

@RegisterPlugin(name = "confirmStartupInitializer",
    description = "hangs restheart startup until the user hits <enter>"
    priority = 100,
    initPoint = InitPoint.BEFORE_STARTUP)
public class confirmStartupInitializer implements Initializer {
    public void init() {
        System.out.println("Hit <enter> to start RESTHeart");
        System.console().readLine();
    }
}

With the following code the Initializer hangs restheart startup until the user confirms.

Tip
Watch Initializers

@RegisterPlugin annotation

The following table describes the arguments of the annotation:

param description mandatory default value

name

the name of the Initializer

yes

none

description

description of the Initializer

yes

none

enabledByDefault

true to enable the plugin; can be overridden by the plugin configuration option enabled

no

true

initPoint

specify when the initializer is executed: BEFORE_STARTUP, AFTER_STARTUP

no

AFTER_STARTUP

priority

the execution priority (less is higher priority)

no

10