How does PlayFramework make code changes appear at runtime without restaring and redeploying?
Does it use tomcat internally? If not, can I potentially put my Spring app on top of the server container it uses, and get the benefits of runtime changes.
Note: I know that it is technically possible to do that with Tomcat as well, however, form what I experienced, it is quite buggy, and does not work all the time. Sometimes, it even requires reloading the whole application context (which is around 16s), which goes off the point.
Play works by, as Zenklys points out, checking the last modified date of the java files, and cross referencing them with the .class files that are generated at run time. If it recognises something has changed, then it recompiles them, at runtime.
In Play 1.x – the recompilation is done using the eclipse jdt compiler (org.eclipse.jdt.internal.compiler.Compiler). If you want to see the code from Play 1.x, just look at the following class – https://github.com/playframework/play/blob/master/framework/src/play/classloading/ApplicationCompiler.java
In Play 2.x, it looks as though Play does it by interlinking with the SBT tool. Check this out – https://github.com/playframework/Play20/blob/master/framework/src/play/src/main/scala/play/core/system/ApplicationProvider.scala