Skip to main content

Using Bean Scopes

  • Chapter
  • First Online:
Introducing Spring Framework 6

Abstract

So far, we’ve seen the basic requirements of a My Documents application, and we’ve explored some aspects of configuration of a simple implementation of a search engine that can return either all documents or documents of a specific type.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 44.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 59.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    There is actually another bean scope available, called thread, but you have to do some setup to use it. It’s not typically registered because scoping a bean to a thread tends to create memory leaks unless the programmer is very careful.

  2. 2.

    We could have read the configuration manually and looked for the scope attribute directly; there are also ways to look at the application context and figure out the scope from its internal data structures. This was simpler and avoided the distraction of walking through extra code.

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2022 The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

Gutierrez, F., Ottinger, J.B. (2022). Using Bean Scopes. In: Introducing Spring Framework 6. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-8637-1_4

Download citation

Publish with us

Policies and ethics