How do I make the app initialize before the first request?

I have an application that I am running from Intellij IDEA. In a global object, I have an onStart binding that starts Akka work orders.

When I run this application, it hasn't initialized until I call a request to one of the controllers.

Is it possible to make the framework look initialized?


source to share

1 answer

Your solution is correct and will work as desired. After starting the application, the onStart () method from GlobalSettings . called before any request is made.

To make it easier to develop in dev mode, it works a little differently and the framework automatically restarts the server after making changes to the source code, but only after the first request is made. What for? If the framework is updated every time, it will constantly reload. Hence, the first request is used as a trigger to start the process.



All Articles