Enterprise Architect in HCL Technologies a $7Billion IT services organization. My role is to work as a Technology Partner for large enterprise customers providing them low cost opensource solutions around Java, Spring and vFabric stack. I am also working on various projects involving, Cloud base solution, Mobile application and Business Analytics around Spring and vFabric space. Over 23 yrs, I have build repository of technologies and tools I liked and used extensively in my day to day work. In this blog, I am putting all these best practices and tools so that it will help the people who visit my website. Krishna is a DZone MVB and is not an employee of DZone and has posted 64 posts at DZone. You can read more from them at their website. View Full User Profile

Play 2.x (Scala) is it a Spring MVC contender? – Introduction

04.01.2013
| 4822 views |
  • submit to reddit

For people in hurry here is the code and the steps.

I have been playing with Scala and Play 2.x for past 6 months and have gained lot of knowledge. I have been working with Spring related technologies for past 8 yrs. In the next few blogs I will be really exploring if the Scala flavor of Play 2.x is ready for prime time.

As usual, I will be exploring how well we can build Data Access Layer, Controller, Frontend integration with Play 2.x using Test Driven Development. I will also be exploring how well Play 2.x is integrated with Security (Authentication/Authorization) capabilities and how well Scala is integrated with other Authentication systems like LDAP.

The use case I will be talking in the next few blogs is the popular Coffee Supplier web application, which demonstrates a simple CRUD base application. And I will elaborate aspects only Admin users can create the Coffee and Normal users can see the list.

One common thing about Play 2.x and Spring MVC is both follow MVC design patterns. There are also other Scala Web frameworks like Lift, I haven’t played with it yet.

Overall architecture of Play 2.1 MVC is as below

Play 2.1 over all architecture

Play 2.1 over all architecture

In this example, I will use popular tools like Slick to access the Database, Play-Auth to do authentication and authorization. And I will extensively use ScalaTest to do Test Driven Development( TDD)/ Behavior Driven Development( BDD).

The layers I will be developing in TDD in the order are,

 

Published at DZone with permission of Krishna Prasad, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)