vadimiron
vadimiron

Reputation: 219

Playframework run and Global.onStart

When i run application in DEV mode (play run) my Global.onStart method is not executed. But if i "play start" my application then Global.onStart runs as it should.

How can i execute Global.onStart by "play run"ing it ?

I use the java version 2.0.2

Upvotes: 5

Views: 2114

Answers (3)

kasur
kasur

Reputation: 1590

In case you do not have application.mode specified in your conf file, starting the application using play run and play start triggers dev and prod modes respectively play docs.

That said, and taking into account the differences between the modes (more details here), namely

Play starts the application immediately (including any bootstrap jobs), rather than waiting for the first request, again adding a small performance benefit for first use

you might want either play start or change the mode to PROD in your config file.

Upvotes: -1

i.am.michiel
i.am.michiel

Reputation: 10404

When you add an method in the global object, you might have to kill the current application and restart it in order to reload your changes.

Upvotes: 0

vadimiron
vadimiron

Reputation: 219

In dev mode, onStart is called with the first request

That was the answer for my question - thank you!

Upvotes: 6

Related Questions