How do Grails or Play detect changes and hot reload classes?

有些话、适合烂在心里 提交于 2019-12-02 22:26:56

Play does it using the Eclipse JDT to compile code at run-time.

Take a look at the following class, that is used by Play to perform the necessary compilation at run time.

https://github.com/playframework/play/blob/master/framework/src/play/classloading/ApplicationCompiler.java

Also, just to note the difference between the DEV mode and PROD mode in Play. This is a design decision made by the Play developers that once an application is put into Production mode, the classes are compiled when the server starts, and are not checked for hot-reloading. This makes sense because in PROD mode, your code should not really be changing.

In DEV mode, Java files are checked for updates each time a new request is received, and any changed files are automatically recompiled (and errors displayed directly in the browsers). This process is very productive in DEV mode, because you will be changing code often, and the immediate feedback is very powerful.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!