5 The Spring context: Bean scopes and life cycle
This chapter covers
- Using the singleton bean scope
- Using eager and lazy instantiation for singleton beans
- Using the prototype bean scope
Thus far we have discussed several essential things about object instances managed by Spring (beans). We covered the important syntaxes you need to know to create beans, and we discussed establishing relationships among beans (including the necessity of using abstractions). But we didn’t focus on how and when Spring creates the beans. From this perspective, we’ve only relied on the framework’s default approaches.
I chose not to discuss this aspect earlier in the book because I wanted you to focus on the syntaxes you’ll need up-front in your projects. However, ...
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.