Documentation

You are viewing the documentation for the 2.2.x release series. 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.


Found an error in this documentation? The source code for this page can be found here. After reading the documentation guidelines, please feel free to contribute a pull request. Have questions or advice to share? Go to our community forums to start a conversation with the community.