Java Development: Spark as a lightweight web framework in Java world

There are several powerful technological stacks available to create any kind of web application from a set of microservices with REST API to huge enterprise solutions. They a based on appropriate programming language as a platform, like Java, C#.NET, Python, PHP, etc. All those web development platforms are completely separated. They are rather linked and even much more than you ever imagine. Trends are popular in one platform found their mirror in another and vice versa. That’s mostly because of enthusiastic activity of multi-platforms software developers. E.g., a lot of Java Development packages and approaches are converted into their C#.NET clones almost one-to-one with adding a .NET suffix.


Another example of multi-platform web development approach is micro frameworks. These are very light MVC frameworks that provides basic web application functionality out of the box. On the other hand, they need minimal code and development efforts as a whole to implement and launch ready to use application. PHP has Slim, Limonade, Lumen, Flight, Silex. Sinatra is the most popular Ruby micro-framework. Flask is for Python stack. For Java Development there is a Spark [http://sparkjava.com/].

Spark in Java world

Actually, the most widely useful web frameworks in Java Development are Spring MVC, Grails and Play. But all of them are pretty outstanding of the problems Spark is designed to solve. Grails is an analog of Ruby on Rails architecture. Play framework has primary position as Scala framework. Spring MVC is the most popular, but old and very huge to launch. As you see, Spark has its own place in Java Development. It’s a trend with a lot of hype around.

Spark is a Rapid Application Development approach. Just several lines of code provide an implementation of web application ready to compile and launch as a process listening on 4567 (by default) port without any servlet container. Minimal code means minimal time and budget costs for implementation and further support. As modern technology, Spark is based on new Java 8 features. XML is not used as standard for configuration. That means configuration process is much faster than 10-years-old Spring bean configuration.

Micro-framework for microservices

A lot projects implemented by Java Spark are regular web pages. But most of the real use cases are some services that provide REST API for their clients. The idea of microservices technology is splitting huge application into several tiny services. These parts can be treated as almost completely separated web applications. They can call each other in case of dependencies in the workflow or data usage. As data and business logic spread among several services, it’s hard to have a state of the client session on the server side. So, the architecture should be stateless. JAX-RS is a classic way to build REST API in Java. But it’s messy at line of overuse of annotations. That makes Spark to look even more cool.

Read also

Comments are closed.