SingletonScopeis the default scope, used when no scope is specified explicitly. Beans of this scope are unique for the whole Petite container and will be instantiated by container only once. On the other hand, beans of
ProtoScopeare instantiated every time when lookuped.
foois retrieved from the container, a new instance of
Fooclass will be created. And each time Petite will inject the same instance of
Booclass, since scope of
boobean is (implicitly set as)
ProtoScope- beans are created each time requested.
SingletonScope- beans are singletons for the container.
SessionScope- beans are singletons in current HTTP session. To have this feature, the
RequestContextListenermust be used.
ThreadLocalScope- beans are unique in the current thread.
SessionScope(in a servlet container), the following listeners has to be added to the