4 The Spring context: Using abstractions

This chapter covers

  • Using interfaces to define contracts
  • Using abstractions for beans in the Spring context
  • Using dependency injection with abstractions

In this chapter, we discuss using abstraction with Spring beans. This topic is essential because in real-world projects, we often use abstractions to decouple implementations. As you’ll learn in this chapter, we ensure our application is comfortable to maintain and test by decoupling implementations.

We’ll start with a refresher on how to use interfaces to define contracts in section 4.1. To approach this subject, we begin by discussing objects’ responsibilities and find out how they fit in a standard class design of an app. We’ll use our coding skills ...

Get Spring Start Here now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.