scope vs scope type vs context

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

scope vs scope type vs context

I am looking for formal definitions of scope, scope type, context

The scope of a bean determines the lifecycle of its instances, and which instances of the bean are visible to instances of other beans,

Scope type:
A scope type is represented by an annotation type.

Scoped objects, exist in a well-defined lifecycle context: 
Custom scopes are normally defined by portable extensions, which must also provide a context object, as defined in The Context interface, that implements the custom scope.

These seem vague.

Specifically it seems that the spec prefers to talk about "contextual instances" rather that about a uniform set of objects that represent the current "context".

Intuitively to me "scope" relates to "context", as "class" relates to "object". The scope seems like a composite type, consisting of all beans (not bean instances) marked with the same scope annotation. The context is an object cache that collects the bean instances of that scope created during a dependency injection pass.

Can someone clarify these terms?

cdi-dev mailing list
[hidden email]

Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 ( For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.