Reputation: 2326
Recently, Play! Framework 2.4 introduced us to the magic world of Dependency Injection and it's benefits but what application specific singletons are there? Digging through the documentation, I've found a couple already:
ActorSystem
Application
Configuration
Are there any more? Is there a central place where all these are listed?
Upvotes: 2
Views: 239
Reputation: 802
Play 2.4 gets rid of global variables defined in Global, i.e. GlobalSettings, in Play 2.3 and before. A specific implementation of an abstraction will be used at run time via dependency injection. This makes your application more flexible and easier to test. Guice is one of good dependency injection frameworks. This is an example of using Guice in Play 2.4 for dependency injection. https://github.com/luongbalinh/play-mongo/blob/master/app/modules/DIBindingModule.scala
In addition, your configurations for different deployment environments, such as local, alpha, and production, are defined in different application.conf files respectively.
Upvotes: 0