Java Web Development Frameworks: Play 2.0 and Spring MVC

Recently I was exploring alternative Java Web Development frameworks, I stumbled upon Play 2.0, I wanted to compare this against Spring MVC which has a good enterprise development capabilities. In this blog I will discuss few of those points. Though I am biased towards Spring MVC, I still liked Play 2.0 as a potential candidate. Also note, there are some major differences between Play 2.0 and Play 1.0.

Taking advantage of existing knowledge

Play 2.0 support MVC design pattern similar to Spring MVC. Java is the primary language in Play 2.0, it also support for Scala. Lift is another popular framework that support Scala. There is a good comparison of Play 2.0 and Lift here. Java developers can be productive immediately, I was up and running a web application in 15mins.

There is a good article in Stackoverflow comparing Play 2.0 with other non java frameworks like, Grails and  Django on What is pro and contra of using Play Framework?

SBT: Ease of build

Play 2.0 uses SBT (Simple build tool) for build process and Maven for repository management. Maven and Gradle are popular among Java and Spring MVC world for build and repository management.

SBT Support for continuous Integration

As mentioned earlier, Play 2.0 is built on top of SBT. SBT has plugins for Hudson for continuous integration

Netty based Ease of deploy

Play 2.0 is built on top and bundled with Netty web server which is an asynchronous event-driven network application framework. Netty is similar to Node.js, which is popular among people who are looking for high performance web application development. It also supports websocket protocol.  Ideally for deployment, you can use commands like

play dist
play publish

The above commands will zip the whole Play 2.0 application into a zip file and publish the application to Maven repository. In the Production environment, based on the version, you can download and unzip and run the Play 2.0 environment. There are few good articles around this in Stackoverflow, Play Framework Deployment.

The other and not so preferred way is to bundle the play application in a war file and deploy it in a Servlet container like vFabric tc Server. When you do this, you will not exploit the full potential of Play framework like Netty. Play development team will support Servlet containers like vFabric tc Server in their future version, till than there is a article in Stackoverflow which shows how to deploy in Tomcat.

Ease of Unit test

There is a good article on how to do JUnit test in Play 2.0. This will demonstrate testing of all the layers of Play 2.0 like Routes, Controllers and Views. Play 2.0 definitely encourages Test first development. Sonar is a good software quality measuring tool, there are also some configuration for integrating SBT with Sonar.

Support for ORM: Ebean and JPA

Play 2.0 primarily supports EBean and JPA. There are hacks to support iBatis and other lightweight ORMs but it is not officially supported.

About these ads

7 thoughts on “Java Web Development Frameworks: Play 2.0 and Spring MVC

  1. Pingback: Harnessing New Java Web Development stack: Play 2.0, Akka, Comet | Spring under the hood

  2. Pingback: Play 2.0: Web Development Framework using Scala | Spring under the hood

    1. Krishna Post author

      Sergey,

      I am biased because I have been working for last 5yrs on Spring MVC and last 10yrs in Java. I have recently started working on Play. I am comparing Play with Spring MVC. I am mainly comparing Play with Scala and Spring MVC and as of my current knowledge I see few things not clear in Play like, Security (wrt Spring Security), ORM (wrt Hibernate, iBatis), Integration Tomcat (wrt war deployment and older servlet spec support) and other legacy app servers. For green field application Play may be an alternative. But for migrating existing application, learning curve for existing developers there is still a question mark.

      In my next few blogs I will start deep diving on comparing Play with Spring MVC, stay tuned.

      Thanks for visiting my website.

      Reply
  3. kheralalit

    Hi, i have basic knowledge of servlets , jsp and beans.
    I have developed few applications using core servlets and jsp.
    What i need to understand spring mvc. what are the pre-requirements for spring mvc? do i need to work on core spring or directly i can start with spring mvc module?? i have an interview within 4 days from now

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s