Lifecycle management

An app can define callbacks that are called at specific points during its lifecycle:

Callback Description
onStart() Called when the application is started.
onStop() Called when the application is stopped.

The onStart() callback is called after the application’s REST routes have been constructed and right before they are opened to serve requests. It is a good place to acquire resources before the application starts processing requests.

The onStop() callback is called after the application’s REST routes have been closed. Resources acquired during onStart() should be released here.