Book Image

Mastering play framework for scala

By : Shiti Saxena
Book Image

Mastering play framework for scala

By: Shiti Saxena

Overview of this book

Table of Contents (21 chapters)
Mastering Play Framework for Scala
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
1
Getting Started with Play
Index

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.plugins").asScala.toList ++ self.classloader...