Disabling lazy loading in the Play app

By default, the Play application will be fully launched (compiled, Global onStart , etc.) only after you complete the http request.

Is there a way to disable this lazy download and make the compilation code of the application for Play and run it after starting the application process?

PS: I am using Play 2.3.

UPDATE: As Ryan noted, lazy loading only happens in dev. Mode. Nevertheless, I still need to disable it, despite the fact that this is relevant only for applications running in dev. Mode.

+5
source share
4 answers

Lazy loading is applied only in dev ( play run ) mode. The production regimen is not lazy.

https://www.playframework.com/documentation/2.3.x/Production

+1
source

As Ryan explained this to developers only.

TIP. IntelliJ Idea has Play support, by default a new browser window opens after starting in dev mode, which automatically initializes compilation.

Very sure you can do the same with a simple script / batch shell file.

0
source

play start . This will launch your application in working mode and load onStart at the beginning of the application.

0
source

You can run the application with testProd instead of run (in the current version 2.5). This will launch your application in prod mode instead of dev.

If you use IntelliJ and not the Play console, you need to create a new launch configuration, select the SBT task, and in the Tasks section, enter testProd .

0
source

Source: https://habr.com/ru/post/1206836/


All Articles