Java Web Development Frameworks: Play 2.0 and Spring MVC
Recently, while exploring alternative Java Web Development frameworks, I stumbled upon Play 2.0, I wanted to compare this with Spring MVC, which has strong enterprise development capabilities. Though I'm 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.
SBT: Ease of build
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 supportswinsocket 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.
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)