The life cycle of an application
An application's life cycle has two states: running and stopped. These are times when the state of the application changes. At times, we need to perform some operations right before or after a state change has occurred or is about to occur.
Play applications use a Netty server. For this, a class with the same name is used. It is defined as follows:
class NettyServer(appProvider: ApplicationProvider, port: Option[Int], sslPort: Option[Int] = None, address: String = "0.0.0.0", val mode: Mode.Mode = Mode.Prod) extends Server with ServerWithStop { … }
This class is responsible for binding or bootstrapping the application to the server.
The ApplicationProvider
trait is defined as follows:
trait ApplicationProvider { def ...
Get Mastering Play Framework for Scala now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.