Note: This page covers the new module system to add functionality to Play.

The deprecated play.api.Plugin system is removed as of 2.5.x.

A module can be written using any dependency injection framework. However, when you want to extend Play, you need to avoid dependencies on a specific framework so that your extension can work independently of the dependency injection. Play previously used the play.api.Plugin system for this purpose, but in 2.5.x, Plugins have been replaced with Play modules.

A Play module is a class that extends play.api.inject.Module and can be registered with Play without relying explicitly on a particular dependency injection framework. This allows everyone to use Play modules.

A module can detect when Play shutdown occurs by injecting the [play.api.inject.ApplicationLifecycle]((api/scala/play/api/inject/ApplicationLifecycle.html) trait into the singleton instance and adding a shutdown hook.