Search code examples
javaspringreferencegarbage-collectionapplicationcontext

Spring Context Reference java


I know that in java, objects are eligible to be deleted by Garbage Collector if no reference refers to them.

So my question is : how spring can make spring bean available all time?

I think there is some object which refers all beans. But these objects instead?

Maybe they are java Properties.


Solution

  • The ApplicationContext's BeanFactory (YMMV) has references to all the (non-prototype and some other scope) beans it creates, as well as all the utility objects it uses to create them.