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 |
---|---|---|---|
|
the name of the Initializer |
yes |
none |
|
description of the Initializer |
yes |
none |
|
|
no |
|
|
specify when the initializer is executed: |
no |
|
|
the execution priority (less is higher priority) |
no |
|