Category: Scala

Testing with Specs2 and Play ReactiveMongo

Are you building a Scala PlayFramework application with ReactiveMongo? Are you testing your application with Specs2? Are some of your tests failing with the dreaded, “Can’t get ClosableLazy value after it has been closed”? Do those same tests pass, if they are run individually? If so, this post is for you! Note: A full stack trace for the dreaded ClosableLazy can be found in the Appendix of this post. In...

Scala Futures by example

What is a Future? A Future is essentially a placeholder object that is created for a result that does not yet exist. Scala Futures are asynchronous and non-blocking (by default) and are thus often handled with callbacks. Hmm. What about ‘callback hell’? Scala Futures are monadic in nature and can be combined, composed, sequenced, and executed concurrently. All of this can be accomplished with Scala in a very simple, yet...

REST example with PlayFramework Scala

Scala is an incredible language!! It is ridiculously concise and is packed full of wonderful features that combine to provide a pure functional and pure oo language. Currently, I am working on two Scala Play2 projects and I couldn’t be happier. In this post, we will build a super simple REST service using Play and Scala. Once again, we’ll go with the Cars theme! Prerequisites: – Download and Install the Typesafe Activator –...