Matthias Hamann
Matthias Hamann

Reputation: 727

Bootstrapping Json TestData in cuba-platform app

I would like to create test-data based on cubas Json-Export-Entity feature.

Where is the entrypoint to bootstrapping datas in cuba?

Upvotes: 0

Views: 93

Answers (1)

knstvk
knstvk

Reputation: 637

The proper way of executing code on starting of an application block is using the AppContext.Listener. For example:

AppContext.addListener(new AppContext.Listener() {
    @Override
    public void applicationStarted() {
        System.out.println("Application is ready");
    }

    @Override
    public void applicationStopped() {
        System.out.println("Application is closing");
    }
});

You can add this listener in any bean constructor or in a method annotated with @PostConstruct.

See also the documentation.

Upvotes: 2

Related Questions