Play 2.4.0 “Damiya” released, adds new DI support and test APIs
Got 20min? Above, Markus Jura shows you how to get started with Play in Java.
On behalf of the Play team here at Typesafe, I'm proud to announce the release of Play 2.4.0, named “Damiya”. The focus of this release has been dependency injection, allowing Play apps to natively be written in a way that allows loose coupling between components. This makes the apps easier to test, and paves the way for our plans to remove global state in Play 3.
The name of this release is “Damiya”, in memory of Play contributor Kate von Roeder, who went by the alias damiya on GitHub. This is the first release of Play to be named, and the name will apply to every release in the 2.4.x series. We welcome people to use the name Damiya as a casual reference to the release, but encourage the use of the version number in official channels such as on the issue tracker and helping newcomers on the mailing list.
Dependency Injection, any way you like
Out of the box, Play provides a smooth, zero config dependency injection experience using Google Guice. Play components, such as the database connection pool, WS client and the Akka actor system can be injected into your components, you can provide your own component bindings, and Play's routes compiler now generates an injectable router. Comprehensive documentation, both for Java and Scala, guides you to using these new features.
It's fair to say that not everyone thinks Guice is the best way to do dependency injection, particularly in the Scala world, and many people would prefer to use frameworkless dependency injection mechanisms such as the cake pattern, implicit wiring, macro-based wiring or just manual wiring using constructors. Fine with us: Play supports whichever approach you want to use, providing factory methods for all components, as well as helper traits that wire some of Play’s internal components.
Also, for those of you that prefer to use a different runtime dependency injection provider to Guice, Play’s core runtime DI support only requires a JSR330 implementation, so you can write your own provider to use any JSR330 provider you wish.
Improved Testing in Java and Scala
With first class support for dependency injection, testing Play apps is now easier than ever. Play provides comprehensive APIs for mocking components in the application both in Java and Scala, as well as a number of helpers for testing components such as DAOs and rest clients in isolation from the rest of your application.
Thank you to the thriving Play community!
Play 2.4 is the work of 176 unique committers, with a total of 494 unique committers for the whole Play 2.x codebase. This release, we’ve also had greatly increased participation by the community in the design of new features and day to day management tasks of the project, with 7 core integrators spending considerable time reviewing pull requests, triaging issues, and contributing themselves.
Anyone can get involved in contributing to Play, our Get Involved page on the Play website is a great place to start, you can also jump into our contributors channel on Gitter, and subscribe to the dev mailing list for the design discussions.