Skip to content

Introduction

Framework and the library

This section describes the basics of the Spring framework. While a library is a collection of objects, classes and methods that our application can use and it is the developers who decide when, where and how to invoke and use its particular parts, the framework is a specially prepared framework that defines the basic structure and behavior of the application, but allows the programmer to insert your code in specific places. This is called the inversion of control (IoC) mechanism.

Frameworks, including Spring, free the developer from creating the entire application from scratch. The basic application base is "for free", thanks to which we are able to create the basic functionality of the application much faster. In addition, we are not forced to test certain parts of our application (they have already been tested by the developers of the framework and the community).

The use of frameworks, despite many advantages, also has its drawbacks. First of all, they add some overhead on the application performance and sometimes, due to the closed structure of the framework, they force a specific way to solve the problem. The creators of the Spring framework have created an excellent documentation, in which we can find solutions to most of the problems we encounter while learning it.

Spring Framework

The first version of the framework Spring had its premiere in 2003. Despite its age, this framework has undergone a metamorphosis and is constantly being adapted to the current requirements of the IT world, through integration with the latest popular technologies. To be able to use all the possibilities of the framework, you need to understand its basic parts well, i.e.:

  • IoC (Inversion of Control) container
  • mechanism responsible for dependency injection
  • part responsible for configuration

Basic Elements

The Spring framework can be used to create web applications thanks to the rich and mature web layer. In addition, Spring is great for creating various applications thanks to:

  • support for the persistence layer - database layer
  • easy implementation of transactions for individual operations
  • possible use of the MVC model (so-called model - view - controller)
  • support for aspect programming (the so-called AOP)

Spring a JavaEE/JakartaEE

Spring is often compared with Java Enterprise Edition. While the assumptions of both technologies are similar, the approach to solutions is slightly different. JavaEE forces the application to run on a special application server that supportsJava Enterprise. In turn, Spring has no such restrictions. Applications based on Spring can be run, for example, using theTomcat or Netty server.

In addition, the developers of Spring try not to use thoseJavaEE standards that work and do not use those that are clunky in their solutions. Equally often they propose their own solutions or extend the possibilities of other standards.