Any framework is one of the tools that help to develop software solutions faster and better.
The basic principle of a framework is not having to reinvent the wheel. Frameworks allow developers to make their life easier and to help them focus on business logic rather than worrying about common pieces of code.
And since Java is not one of the simplest programming languages, frameworks are definitely a useful tool here.
In this article, we’ve gathered some of the most spread and worthwhile frameworks which can help you in Java app development.
This is the absolute leader among other Java frameworks. Knowledge of Spring is one of the most common requirements for a Java developer position. The are many reasons for that, but the main one is universality.
Spring is a powerful, lightweight, and most popular framework for Java EE. As the developers themselves say:
Spring makes Java simple, modern, productive, reactive, cloud-ready. It is known for its dependency injection and aspect-oriented programming features. In fact, it is a container of frameworks that allow you to perform tasks of any complexity - from working with the databases to testing procedures.
Developers are much more likely to choose Spring MVC and Spring Boot. The biggest advantage of these frameworks is the ability to detach other modules and focus on one due to inversion of control (IoC).
- Uses POJOs (Plain Old Java Objects) that lead to a simpler and more flexible codebase;
- Supports modularity (with lots of packages and classes);
- Backward compatibility and easy testability;
- Huge ecosystem (Spring Boot, Spring Cloud) and community;
- Extensive documentation and multiple Spring tutorials.
- Not so easy configuration
- Steep learning curve
To check the popularity of each framework, Google Trends was used.
Here are the statistics of Spring popularity for the last 5 years:
Spring popularity had periods of decline, but the overall picture shows it is growing year after year.
As already mentioned, Spring has a very active community and 37K of stars on Github.
Play is another lightweight framework that most developers enjoy. It allows you to build web applications with Java & Scala. It was designed for modern mobile and web applications’ needs.
Play is based on stateless, web-friendly, and lightweight architecture. The main distinguishing features include high speed, quality, and good scalability. It is built on Akka and gives agility to think in the more high-level way - not what to do with Data element, but how to handle a stream of things.
The framework has asynchronous APIs that allow you to scale applications without introducing additional resources. This framework provides excellent support for various microservice patterns.
- Improves efficiency due to hot code reloading;
- Play is pluggable, configurable, customizable, and thus is flexible;
- Easy to debug: Play can handle error in dev mode for runtime and compile errors;
- Built on Netty, and supports non-blocking I/O;
- Open-source and everything works well under the hood;
- Easy to get started.
- Play 2 is basically a rewrite of the Play 1;
- Built around async I/O, which means writing code that "executes later".
According to Google Trends, the framework had a decline in 2016- 2018. Now its popularity is growing again:
Github stars: 11,6K. The framework is used by such major companies as LinkedIn, Samsung, The Guardian, Verizon and others, which confirms its reliability.
Spark Framework is a microframework and domain-specific language for the Java and Kotlin programming languages. Kotlin also runs on JVM, and it’s 100% interoperable with Java. With Spark, you can painlessly develop web applications, microservices, and REST APIs.
In fact, you can get the Spark framework up and running in just a few minutes. By default, it runs on the Jetty web server that is embedded into the framework. However, you can use it with other Java web servers as well.
- Built for productivity;
- Lets you take full advantage of the JVM;
- Easy to get up and running;
- Extendable and you can plug in any template engine.
- Suitable only for creating small web applications or API backends.
Spark had a gradual popularity jump somewhere between 2016 and 2018. Now the interest in the framework is a bit lower:
Github stars: 8,8K. Spark is used by such companies as Arquillian, Apache, Asana, Playlife.
Jhipster is one of the latest Java frameworks. It was released in 2013. Jhipster integrates Spring Boot, Angular, and React into one large framework. It allows you to build a modern Java-based web application easily.
Spring Boot, built into the framework, will allow you to develop applications based on the Spring. Besides Angular and React, JHipster also contains Bootstrap. This framework allows developers to choose between two types of architecture: monolithic and microservice. In the first case, frontend and backend are integrated into one application, in the second case - they are separated.
By the way, JHipster is used by such brands as Adobe, Siemens, Bosch, HBO, and Google.
- Easy bootstrap of a new project with a lot of technologies preconfigured;
- Follows best practices and latest trends in backend and frontend development;
- Embraces cloud-native principles with Docker and Kubernetes;
- Log in, sign in, user management and monitoring comes out-of-the-box;
- Only those technologies you select are included in the project.
- To work with JHipster, it’s better to be familiar with a bunch of technologies;
- REST responses returned from endpoints not always correspond to business requirements;
- Not all of the options that are available at the same level.
According to Google, the peak of JHipster popularity was in 2018 and it begins to decrease slowly:
Github stars are close to the Play: 16,2K. Companies using JHipster: Adobe, CGI, BOSCH, HBO, Siemens, and others.
Blade is a lightweight Java 8+ MVC framework. When we talk about the lightness of Blade, we mean the size of its source code, which does not exceed 500KB.
This is a simple framework with a RESTful-style interface routing. It belongs to a few Java frameworks which have no invasive interceptors. Its most striking advantage is the ability to create web applications quickly.
To use Blade, you need to create a regular Maven project. Blade provides the modularity support Java 9 has. It also supports quite many Java web components.
- Modular: the one can choose which components to use;
- Supports plug-in extensions and web jar resources;
- Embedded jetty server and template engine support;
- RESTful style routing;
- Supports JDK 1.6 and up.
- Helpful in creating only small MVC applications;
- The documentation on the main site is in Chinese (but it does have documentation in English).
The overall Google stats show the popularity of Blade is gradually getting up:
Github stars: 5,3K.
While talking about the best Java web frameworks, Hibernate can’t be ignored.
Hibernate is an ORM (Object/Relational Mapping) framework. It allows you to write queries to the database server not in SQL, but in Java, which changes the usual look at the databases in general.
Despite the fact that Hibernate is not a full-fledged framework, it allows you to easily convert information for various databases. This feature also simplifies scaling, regardless of the application size and the number of its users. In general, this framework can be described as fast, powerful, easily scalable, and customizable.
It is free software distributed under the public 2.1 License of GNU Lesser General.
- Hibernate enables you to communicate with any database by making tiny alternations in code;
- MySQL, Db2 or Oracle, Hibernate is DB independent;
- Caching instrument to bug catalog with same queries;
- N+1 or Sluggish loading support;
- Low risk of data loss and it requires less power.
- If the power goes off, you can lose all your data;
- Restarting can be extremely slow.
Looking at the graph below we see the Hibernate popularity has been lowering during these 5 years:
MyBatis is a mapping framework for programming in Java. It simplifies the process of linking your Java application with an SQL database: it acts as a middleware between them.
Typically, you will need the Java Database Connectivity API to connect your application to a relational database. MyBatis simplifies the process. It gives developers the ability to perform basic SQL operations using only a few lines of code.
MyBatis can be compared with the Hibernate framework. They both represent a kind of bridge between the application and the database. The only difference is that MyBatis does not map Java objects to a relational database.
- Simplicity and faster development;
- XML tags, support for dynamic SQL statements to write;
- Good for writing pure SQL.
- SQLs might be tied to a specific database vendor;
- Poor database portability.
According to Google, interest in the framework is growing little by little:
Github star rating: 13,6K.
Struts is an open-source MVC (Model-View-Controller) framework for creating enterprise-level Java web applications. The initial Struts framework (Struts 1.x) was rebuilt in 2007 when it was merged with the WebWork framework. Struts 1.x and Struts 2.x are not interchangeable, as there are important differences between them. You can download both from the Struts’ Releases page.
The main advantage of the framework is its portable plugins, which are JAR packages. Hibernate and Spring plugins, in this case, can be used for object-relational mapping and dependency injection, respectively. This framework also helps to reduce overall development time by successfully organizing Java, JSP, and Action classes.
- Is simple to use and is based on MVC design pattern;
- Works well with REST, JSON, and AJAX;
- Integrates with other Java technologies via plugins;
- Supports themes and templates;
- Uses simple POJO-based actions.
- Hard-to-navigate documentation;
- Not suitable for smaller applications.
Google shows the Struts popularity has its peak in 2016-2018, and now it starts to decline slowly:
Github rating is not high:1k stars. Struts is used by Synopsys, ExpertIO, Nsys Design Systems, and other companies.
Vaadin is an open-source client-server framework that allows you to create web applications using pre-designed UI components. It’s built specifically for business applications with a focus on accessible, good-looking and intuitive UIs.
Vaadin allows you to write UI in plain Java without getting bogged down in JS, HTML, and CSS. Additionally, you can create layouts in HTML or with a visual designer. Vaadin provides access to the DOM directly from the Java virtual machine. Besides, it comes with ready-made themes you can customize via a styling API.
- High developer productivity and fast development;
- Built on the Web Components standards;
- Provides many components, layouts, and different listeners compared to any conventional web technologies;
- Automates client-server communication and routing;
- Has good documentation and an active community.
- Is less scalable than other available technologies;
- The initial loading of large applications can be slow.
As for popularity, it is declining slowly:
Github rating: 1,6K stars. Vaadin is used by Docucom, AXPM, CGI, HPD LendScape and others.
10. JavaServer Faces (JSF)
JSF is a JCP Standard technology for authoring component-based user interfaces on Java EE platform. This framework may not be the best one, but the big advantage is the Oracle support, lots of additional tools, great documentation, and a friendly community.
JSF can be used to create enterprise applications, native programs, and web development. Developers can build web applications by assembling reusable UI components in a page, connecting these components to an application data source, and wiring client-generated events to server-side event handlers.
- JSF is an important part of Java EE and is convenient for developers who use IDE software.
- To work with JavaServer Faces, it’s better to have great knowledge of Java, to understand web technologies in general, and be experienced in working on the web without any frameworks.
According to the graph below, JSF is losing popularity:
As it was mentioned, JSF is not the best technology but is great for IDE software.
Java frameworks are considered as some of the most significant support for developers today, and therefore, are here to stay. We tried to list the most promising and useful of them. The main thing is to choose the most suitable framework for a particular project.
If you have anything to add, we’d be happy to read it in the comments below.