Skip to content
JonathanO edited this page Oct 27, 2012 · 1 revision

By default beans are singleton scoped. Requesting the same bean (with get(), or by use of ref in the context) will give you the same instance. By default this applies even over multiple ApplicationContext instances if they're accessing the same XML files, as they make use of a static cache.

Beans can also be marked as prototype scoped with the scope attribute. This means that a new instance will be instantiated each time you request one. Note that mixing scopes is fine, but you need to think about what the result will be.

Clone this wiki locally