Why Spring Matters for Java Developers

RMAG news

Writing Java Applications in the Past

When writing Java applications in the past, writing all the functionalities from scratch was common. It was time-consuming, requiring significant effort to create various factories, infrastructure code, setup code, etc.

Growth of the Java Ecosystem and the Problem with Large Libraries

As the years passed, the Java ecosystem grew, and many libraries were created and shared to solve developers’ common development problems. While these libraries were useful, they started to come with a cost.

These libraries grew too large, and using a simple functionality from a library required loading the entire package. Imagine importing a library with a thousand classes just to use a single one. Packaging your application would include all those classes even if you only needed one.

The Solution: Small, Specific Libraries and Spring

This became a problem. A better idea was to have small libraries specific to certain problems, decoupled by topic. Instead of having large jars that did everything, we started to use small jars to solve specific problems.

For example, Jackson is a library specialized in serializing and deserializing JSON objects.

Now, Spring is a collection of these useful jars that can help you create your applications. It allows you to create a combination of dependencies (libraries) that suit your needs.

Benefits of Spring

Spring helps by using the convention over configuration pattern. It creates a series of infrastructure beans based on the dependencies you add to your project, making things easier by providing a default configuration and allowing you to configure only what matters to you.

For example, are you using Kafka? Use the Spring Kafka dependency, customize your Kafka broker URL and some other configurations, and you’re ready to go. Spring will provide a bean to send or consume messages from Kafka.

Simplifying Development Decisions

It reduces the decisions developers need to make about handling connections, whether to use a singleton, where to put topic configurations, etc. It’s already done; just customize it, and you’re ready to go.

Spring uses these abstractions to make you more productive so you can focus on what matters most!

Do you use Spring in your projects? Many developers started working with Spring without knowing the Java past and how Spring makes our lives easier.

If you like Spring make sure to follow me and stay tuned to learn more! Don’t miss out!

Willian Moya (@WillianFMoya) / X (twitter.com)

Willian Ferreira Moya | LinkedIn

Follow me here on dev.to!