If you’re writing a web application from scratch, you’ll want to select a framework to make your life easier and reduce development time. Java, one of the most popular programming languages out there, offers plenty of options.
Traditional Java applications, particularly web-facing apps, are built on top of a Model-View-Controller (MVC) framework, which follows the MVC software architectural pattern. Starting with Apache Struts, MVC frameworks have been a staple of Java development including such popular frameworks as WebWork, Spring MVC, Wicket, and GWT. Typically these applications host the view code on the server, where it is rendered and delivered to the client (web browser). Click a link or submit a form in your browser and it submits a request to the server, which does the requested work and builds a new view, refreshing the entire display in your client.
Fast-forward to 2015, and most Java applications (particularly enterprise applications) still follow this same model. This is not the dominant model on the web, however, where speedy and responsive user interfaces are expected, save buttons are optional, and mobile accessibility is required. Today the popular software architectures are service-oriented with much recent discussion around microservices—individual services which perform only one small unit of work and can scale (increase capacity) separately from each other function of a system. Fortunately, the Java community is well aware of these changes and new frameworks and paradigms exist.
First released in 2004, Spring is the oldest framework on our list. It is the most popular Java framework is nearly synonymous with Java development in enterprise circles. As it expanded to include a full MVC framework it has continued to adapt to change and is a true full-service framework providing services for security, web services, database integrations, and more. One of the latest improvements includes Spring Boot, which provides the configuration and tooling necessary to get an application off the ground quickly and easily create stand-alone applications.
While popular, Spring is not without its downsides. For many applications Spring all-things-to-all-people approach may add an unnecessary layer of complexity, particularly compared with Java Enterprise Edition which includes many core features of Spring in its latest versions.
The Play Framework (not to be confused with Google Play) is the second on our list in terms of both popularity and tenure. It was conceived in 2007 as a web MVC framework supporting REST web services as a first-class citizen. In addition to Java, Play supports Scala, an object-oriented functional language on the Java virtual machine.
Other important distinctions from other frameworks include asynchronous I/O, stateless services, and first-class JSON support. Developer productivity is improved in part due to immediate code refresh, which doesn’t require republishing or restarting.
There are some potential downsides, however. Play chose a complete break from the traditional Java enterprise paradigms such as the Servlet specification. This may render some 3rd party libraries unusable. Also, some Java developers complain about the strong Scala influence of Play which has changed the mental model required to use the framework.
Like Spring Boot and Play, Dropwizard is focused on rapid development and deployment of Java web applications and REST services. While it provides some limited functionality of its own (such as authentication), mostly Dropwizard focuses on the “glue” between components to provide a more integrated development experience. It is designed to be a simple, lightweight framework with everything you need to deploy your Java project.
Dropwizard is still in active development and has not yet attained its 1.0 release. However, it is based around some very stable, best-of-breed libraries that have independently achieved stability and maturity.
Spark started in 2011 as a forward-thinking framework based upon simplicity and modeled after Ruby’s framework. As of Spark 2.0 released in 2014, the framework only supports Java 8. Spark Java should not be confused with Apache Spark, a big data engine. The Spark quick start is a “Hello World” web server that takes just 6 lines of code. It is built for REST web services and is much simpler than typical Java solutions such as JAX-RS. The focus is on developer productivity, and the extremely lightweight framework provides just what is necessary and no more.
The weakness of Spark, as with any other micro-framework, is in the details it ignores. Considerations such as security, database connectivity, etc. are left to the developer to handle with some other framework or library.
It’s an open source web development framework which is built upon frameworks like Hibernate, Spring and GROMS. One of the strong positive qualities of Grails is the Enterprise Java Beans or EJB support. EJB helps developers start their work immediately. They don’t need to configure the XML.
This framework offers speedy development features and lets you create highly robust and scalable applications. There are plenty of ready-made modules available in Grails and you can use them for your work. It offers unit testing feature and based on your requirements, you can integrate other testing frameworks as well.