Plugin declaration
Now that we have defined a plugin, let's see how the Play Framework identifies and enables it for the application. ApplicationProvider
for the production and development mode (static and reloadable applications, respectively) both rely on DefaultApplication
, which is defined as follows:
class DefaultApplication( override val path: File, override val classloader: ClassLoader, override val sources: Option[SourceMapper], override val mode: Mode.Mode) extends Application with WithDefaultConfiguration with WithDefaultGlobal with WithDefaultPlugins
The trait WithDefaultPlugins
line is responsible for binding the plugins to application's life cycle. It is defined as follows:
trait WithDefaultPlugins {
self: Application =>
private[api] def pluginClasses: Seq[String] = {
import scala.collection.JavaConverters._
val PluginDeclaration = """([0-9_]+):(.*)""".r
val pluginFiles = self.classloader.getResources("play...