Skip to content

Understanding Spring

BrunoRosendo edited this page Jul 27, 2023 · 5 revisions

In this project, diving right in and writing code with the flow is possible. However, it's important to acknowledge that Spring has a challenging learning curve, and not having a proper grasp of its core features might lead to some headaches. While the official documentation may be limited, the community has contributed numerous articles and tutorials, which can serve as valuable resources. This section aims to provide a concise overview of Spring and Spring Boot, their benefits, and pointers to further information.

Contents

Spring vs Spring Boot

Spring:

  • Lightweight framework widely used to develop Java (or Kotlin) applications.
  • Its most important feature is dependency injection, which promotes loose coupling and modularity.
  • Offers a vast number of modules that you can use independently from each other (e.g. Spring JDBC, Spring Security, Spring MVC).
  • Doesn't offer features for creating servers, databases, or dependency management.
  • Still has considerable boilerplate, in exchange for more freedom and flexibility.

Spring Boot:

  • Built on top of Spring, providing all its features while being easier to use.
  • Widely used to develop REST APIs (as in our case).
  • Its most important feature is autoconfiguration, which automates the setup process and minimizes manual configurations.
  • Features embedded servers, in-memory database, and dependency management.
  • Greatly reduces boilerplate and lines of code, although it offers less freedom compared to the base Spring framework.

In sum, Spring Boot's motto is taking an opinionated view of the Spring platform, which paves the way for faster and more efficient development.

image

Sources: Baeldung, GeeksForGeeks, and JavaTPoint.

Beans and Dependency Injection

Learning Resources