Intro to Play Framework

Java Edition

James Ward ~ @_JamesWard

Create a New Play App

activator new

IDE Support

activator idea

Run the App

activator ~run

Open the App



  • Based on JUnit
  • Unit Tests with Mocks
  • Functional Tests for Templates, Controllers, Router

Run All Tests Once

activator test

Run All Tests Continuously

activator ~test

Run One Test

activator "test-only my.namespace.MySpec"

Run Failed Tests

activator test-quick


  • EBean for Java
  • JPA Annotations
  • Versioned Evolution Scripts


  • Controller: Bind request data to VO
  • View: Server-side Form Helpers

Asset Compilers

Unified Client/Server Development

  • assets/javascripts/foo.{js|coffee}
  • assets/stylesheets/foo.less
<script src='"javascripts/foo.min.js")'></script>
Specify Dependencies in build.sbt
"org.webjars" %% "webjars-play" % "2.2.0",
"org.webjars" % "bootstrap" % "2.3.1"
Create Route for WebJarAssets Controller
GET     /webjars/*file    
Use a WebJar
<script src='"jquery.min.js"))'></script>

Reactive Requests