Читать книгу Beginning Spring - Höller Jürgen - Страница 9
1
POJO Programming Model, Lightweight Containers, and Inversion of Control
ОглавлениеWHAT YOU WILL LEARN IN THIS CHAPTER:
• Problems of the old EJB programming model that triggered the birth of POJO movement
• Advantages of the POJO programming model
• What a container is and what services it provides to its deployed applications
• Lightweight containers and what makes a container lightweight
• What Inversion of Control (IoC) means and its importance for applications
• Relationship between IoC and dependency injection
• Dependency injection methods, setter and constructor injection
• Advantages and disadvantages of those different dependency injection methods
The Plain Old Java Object (POJO) movement started around the beginning of the 2000s and quickly became mainstream in the enterprise Java world. This quick popularity is certainly closely related with the open source movement during that time. Lots of projects appeared, and most of them helped the POJO programming model become mature over time. This chapter first closely examines how things were before the POJO programming model existed in the enterprise Java community and discusses the problems of the old Enterprise JavaBeans (EJB) programming model. It's important that you understand the characteristics of the POJO programming model and what it provides to developers.
The second half of the chapter focuses on containers and the inversion of control patterns that are at the heart of the lightweight containers we use today. You learn what a container is, what services it offers, and what makes a container lightweight. You also learn how the inversion of control pattern arises and its close relationship with dependency injection terms. The chapter concludes with an examination of two different dependency injection methods and their pros and cons.