Bean Scopes and Lifecycle Callbacks

How long a bean lives, and the two moments the container promises to call you at.

  • 7 cards
  • 4 questions
  • About 7 min
  • Difficulty
Share

Most beans are singletons, and most of the time that fact is invisible — right up until a singleton holds state that two concurrent requests can both reach. This topic is scope, the two lifecycle callbacks worth actually knowing, and the one case where wiring a shorter-lived bean into a longer-lived one needs a small trick to work at all rather than failing at startup.

Contents

7 cardsnot started