Why choose the Spring framework?

Why choose the Spring framework? Cartoon of man with question mark above his head and Spring framework logo

Last week we looked at the benefits of using a framework for software application development. Because this is a series of Java tips, let’s take a look at some of the available Java frameworks.

There are a huge number of Java frameworks available out there, many of them free and open source. Most of these frameworks target a single domain area.

Single Domain Frameworks

For example, frameworks like Hibernate, TopLink, EclipseLink, JPA (Java Persistence API), iBatis, MyBatis, and Apache Empire-db provide elegant solutions to common data persistence problems like mapping Java objects to relational database tables.

There are frameworks/technologies that provide the user interface (view layer) for Java web applications. These include Java servlets, JavaServer Pages (JSP), JavaServer Faces (JSF), Apache Struts, Apache Tapestry, Thymeleaf, Velocity, FreeMarker, Apache Tiles, Apache Wicket, Spring MVC, Vaadin, Play, etc.

There are frameworks that provide serialization and deserialization of Java objects to and from JSON. These include Google GSON, Jackson and XStream. See https://www.json.org/json-en.html.

You get the picture. If you’re looking for solutions to problems in limited domains, there are a vast number of libraries, technologies and frameworks. See a Wikipedia list of them.

However, if you’re looking for a full Java technology stack/framework that covers just about everything you ever want to do in an enterprise Java application, your choices are more limited.

I’m going to go out on a limb here, and say that in my opinion there are only two Java frameworks/technology stacks that warrant serious attention: Java/Jakarta Enterprise Edition (JEE) and the Spring Framework.

In this post I’m going to look at the Spring framework. In the following post I’ll talk about the JEE framework.

The Spring Framework

Spring is a lightweight inversion of control (IoC) Java framework. 

At the heart of Spring is support for dependency injection (DI) and aspect-oriented programming (AOP). It was originally developed as an alternative to the heavyweight J2EE containers. Spring has become very popular because of its practical and consistent approach to Java development. Almost anything that we want to develop in Java is much easier to do with Spring.

Spring provides elegant solutions to common problems in many domains. We can think of Spring as a framework of frameworks.

Spring continues to evolve and grow with every new technology. Developers use Spring extensively for developing Java-based enterprise systems. Over the years, it’s become mature enough to become a de-facto standard for large scale enterprise Java development.

Many projects use Spring Framework as their backbone. The framework is divided into modules which makes it easy to pick and choose the parts we need in an application:

  • Core: Provides core features like DI (dependency injection), AOP (aspect oriented programming), internationalisation (i18n), validation, event publishing, cacheing and JMX management.

  • Data Access: Supports data access with JDBC (Java Database Connectivity), JTA (Java Transaction API) and JPA (Java Persistence API).

  • Web: Supports both the Servlet API (with Spring MVC) and the Reactive API (with Spring WebFlux). Also supports other web technologies like REST web services, WebSockets and STOMP.

  • Integration: Supports integration to JEE with JMS (Java Message Service), RMI (Remote Method Invocation), and channels and gateways to communicate with external systems.

  • Testing: Wide support for unit and integration testing through mock objects and test fixtures.

Spring does not implement all of the Java/Jakarta EE specifications, but it does support the technologies. For instance, Spring supports JPA-based data repositories. Spring also supports industry specifications like Reactive Stream and HATEOAS.

Spring has a suite of additional Spring Projects which provide functionality for enterprise applications. These include Spring MVC and Spring Web Flow for web-based applications, Spring Data for persistence to relational and NoSQL databases, Spring Batch for batch processing, Spring Integration, Spring Security, Spring Cloud, etc.

The latest kid on the block is Spring Boot. Spring Boot allows rapid and easy development of standalone Spring applications. It provides automatic configuration and bootstrapping. Spring Boot can run an embedded servlet container for web-based and REST applications. We also use Spring Boot to develop microservices.

Conclusion

In my opinion, Spring is awesome! It covers the depth and breadth of just about everything we need for Java-based enterprise application development.

There is a huge amount of industry support and demand for Spring programmers. Over the past six or seven years, I’ve probably taught ten times as many Spring courses as EJB and JEE courses.

Next week for balance we’ll look at the Java/Jakarta EE (Enterprise Edition) framework .

Until then, stay safe and keep coding!

2 thoughts on “Why choose the Spring framework?”

  1. Pingback: The JEE Framework • 2022 • Incus Data Programming Courses

  2. Pingback: The Jakarta EE Framework • 2022 • Incus Data Programming Courses

Leave a Comment

Your email address will not be published. Required fields are marked *

Thank You

We're Excited!

Thank you for completing the form. We're excited that you have chosen to contact us about training. We will process the information as soon as we can, and we will do our best to contact you within 1 working day. (Please note that our offices are closed over weekends and public holidays.)

Don't Worry

Our privacy policy ensures your data is safe: Incus Data does not sell or otherwise distribute email addresses. We will not divulge your personal information to anyone unless specifically authorised by you.

If you need any further information, please contact us on tel: (27) 12-666-2020 or email info@incusdata.com

How can we help you?

Let us contact you about your training requirements. Just fill in a few details, and we’ll get right back to you.