Documentation

You are viewing the documentation for the 2.8.0-M4 development release. The latest stable release series is 2.7.x.

§What’s new in Play 2.8

This page highlights the new features of Play 2.8. If you want to learn about the changes you need to make when you migrate to Play 2.8, check out the Play 2.8 Migration Guide.

§Akka 2.6

Play 2.8 brings the latest minor version of Akka. Although Akka 2.6 is binary compatible with 2.5, there are changes in the default configurations and some deprecated features were removed. You can see more details about the changes in Akka 2.6 migration guide.

§Jackson ObjectMapper configuration

Instead of providing its way to create and configure an ObjectMapper, which before Play 2.8 requires the user to write a custom binding if some customization is required, Play now uses Akka Jackson support to provide an ObjectMapper. It means that it is now possible to add Jackson Modules and configure Features using application.conf. For example, if you want to add Joda support, you just need to add the following configuration:

akka.serialization.jackson.jackson-modules += "com.fasterxml.jackson.datatype.joda.JodaModule"

And if you need to write numbers as strings, add the following configuration:

akka.serialization.jackson.serialization-features.WRITE_NUMBERS_AS_STRINGS=true

§Guice support for Akka Actor Typed

The pre-existing AkkaGuiceSupport utility, which helped bind Akka’s “classic” actors, has gained additional methods to support Akka 2.6’s new Typed Actor API.

Here’s a quick example, in Scala, of defining a Guice module which binds a HelloActor:

object AppModule extends AbstractModule with AkkaGuiceSupport {
  override def configure() = {
    bindTypedActor(HelloActor(), "hello-actor")
  }
}

And again, in Java, where the actor extends Akka’s Java DSL AbstractBehavior:

public final class AppModule extends AbstractModule
    implements AkkaGuiceSupport {
  @Override
  protected void configure() {
    bindTypedActor(HelloActor.class, "hello-actor");
  }
}

See Integrating with Akka Typed for more details.

§Other additions

§Build additions

When adding Akka moodules to your application, it is important that you use a consistent version of Akka for all the modules since mixed versioning is not allowed. To make it easier, play.core.PlayVersion object now adds akkaVersion so that you can use it in your builds like:

import play.core.PlayVersion.akkaVersion

libraryDependencies += "com.typesafe.akka" %% "akka-cluster" % akkaVersion

It is now possible to configure a max age for language cookie. To do that, add the following to your application.conf:

play.i18n.langCookieMaxAge = 15 seconds

By the default, the configuration is null meaning no max age will be set for Lang cookie.

Next: Migration Guides