Overview

1 Spring in the real world

Spring is presented as a widely used application framework in the Java/JVM ecosystem that helps developers build many kinds of applications more efficiently. The main idea is that frameworks provide reusable software capabilities for common needs—such as logging, security, database access, communication between applications, transactions, caching, and testing—so developers can focus more on business logic instead of repeatedly writing “plumbing” code from scratch. The text emphasizes that frameworks are not the same as libraries: libraries are called by application code for specific tasks, while frameworks provide a broader structure and often control parts of the application’s execution.

The Spring ecosystem is described as much larger than a single framework. Its foundation is Spring Core, which includes the Spring context, inversion of control, aspect-oriented capabilities, and configuration support. Through inversion of control, Spring manages objects and can call or intercept application code based on configuration. Around this core, Spring offers tools for web applications, persistence, testing, security, cloud development, batch processing, and convention-based application setup through projects such as Spring Data and Spring Boot. The book focuses especially on the foundational parts needed to begin building real-world Spring applications.

The text explains that Spring is most commonly used for backend applications, where it helps manage data, expose services, communicate with other systems, secure functionality, and integrate with databases and message-based systems. It can also be useful in automation testing applications and even desktop applications when object management, persistence, communication, or caching features are needed. At the same time, the text warns that frameworks should not be used blindly: they may be inappropriate when an application must remain very small, when strict security rules require only custom code, when excessive customization would outweigh the benefits, or when replacing an existing working solution provides no real improvement.

David ordered a wardrobe from the UAssemble store. But the store (framework) doesn’t deliver to David (the programmer) just the components (software capabilities) he needs to build his new wardrobe (the app). The store ships him all the possible parts he might need to build the wardrobe. It’s David’s (the programmer’s) choice on which components (software capabilities) are right and how to assemble them to get the right result (the application).
The user’s perspective is like viewing an iceberg. Users mainly observe the results of the business logic code, but this is only a small part of what builds the app’s complete functionality. Like an iceberg that is mostly underwater and hidden from view, we don't see most of the code in an enterprise app because it's provided by dependencies.
You can imagine the Spring framework as a solar system with the Spring Core in the center. The software capabilities are planets around Spring Core kept close to it by its gravitational field.
Inversion of control. Instead of executing its own code, which makes use of several other dependencies, in an IoC scenario, the app execution is controlled by the dependency. The Spring framework controls an app during its execution. Therefore, Spring implements an IoC scenario of execution.
A backend app interacts in several ways with other apps and uses databases to manage data. Usually, a backend app is complex and may require the use of various technologies. Frameworks simplify the implementation by providing tools you can use to implement the backend solution faster.
The possibilities of using Spring in a backend application are endless, from exposing functionalities that other applications can call to managing the database access, and from securing the application to managing integration through third-party message brokers.
The team deploys the testing app in a test environment. A continuous integration tool like Jenkins executes the app regularly and sends feedback to the team. This way, the team is always aware of the system’s status, and they know if they break something during development.
A testing app might need to connect to databases or communicate with other systems or the tested system. The developers can use components of the Spring ecosystem to simplify the implementations of these functionalities.

Summary

  • An application framework provides common software functionality and a structure for building applications more efficiently and reliably.
  • Frameworks like Spring also offer access to large communities, making it easier to find solutions, guidance, and best practices.
  • When choosing a framework, always evaluate its purpose, alternatives, maturity, and community adoption.
  • Spring is more than a single framework—it is an ecosystem of projects. In this book, we’ll mainly use Spring Core, Spring Data, and Spring Boot.
  • Although Spring is commonly associated with backend systems, it can also be used for desktop applications, testing tools, and other kinds of software.

FAQ

What is an application framework?An application framework is a set of common software functionalities that provides a foundation for developing applications. It helps developers avoid writing every piece of program code from scratch by offering reusable tools, structures, and capabilities.
How is a framework different from a library?A library is code that your application calls when it needs help with a specific task. A framework is a larger structure that helps organize the application and often controls how the application runs. In short: with a library, your code calls it; with a framework, it calls your code.
Why do developers use frameworks?Developers use frameworks to save time, reduce cost, reuse proven implementations, and avoid rewriting common application features such as logging, security, transactions, data access, communication between apps, caching, and testing support.
What is business logic in an application?Business logic is the code that implements the application’s business requirements and user-facing behavior. For example, in an invoicing app, the code that generates an invoice when a user clicks a link is business logic.
What is “plumbing code”?Plumbing code refers to the non-business parts of an application that are still necessary for the app to work properly. Examples include logging, security, data consistency, database access, transactions, communication, caching, and performance-related mechanisms.
What is the Spring framework?Spring is an application framework in the Java/JVM ecosystem. It is widely used to build many kinds of applications, especially backend applications, but also automation testing apps and some desktop applications. More broadly, Spring is an ecosystem of frameworks and projects.
What are the main parts of the Spring framework?The chapter highlights several important parts: Spring Core, which includes the Spring context, aspects, and SpEL; Spring MVC, which helps build web apps and serve HTTP requests; Spring Data Access, which supports persistence and database work; and Spring testing, which provides tools for unit and integration tests.
What is inversion of control (IoC) in Spring?Inversion of control means that instead of the application controlling execution entirely by itself, control is given to another piece of software: the Spring framework. Spring can create object instances, manage them in its IoC container, and call or intercept methods based on configuration.
What is the Spring context?The Spring context is Spring’s IoC container. It is the mechanism that glues Spring components and application components together. By making certain objects known to the Spring context, Spring can manage and use them according to the configuration you provide.
When should you avoid using a framework like Spring?You should consider avoiding a framework when you need the smallest possible footprint, when strict security rules require only custom code, when framework customization would require more code than writing the feature yourself, or when an existing working app would gain no real benefit from switching to a framework.

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Spring Start Here, Second Edition ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Spring Start Here, Second Edition ebook for free