Documentation

You are viewing the documentation for the 2.2.2 release in the 2.2.x series of releases. The latest stable release series is 3.0.x.

§Writing Plugins

Play comes with a few plugins predefined for all applications, these plugins are the following:

However, one can easily add a new plugin to an application by following these steps:

import static play.api.Play.*;
import static play.libs.Scala.*;

public Myplugin plugin() {
   return orNull(unsafeApplication().plugin(MyPlugin.class)).api();
}

which will return an instance or subclass of MyPlugin fully initialized or null.

5000:com.example.MyPlugin

The number represents the plugin loading order. By setting it to > 10000 we can make sure it’s loaded after the global plugins.