Chapter 4. Scopes and Contexts

We've already briefly covered scope annotations and how they work, but now we will discuss them in more detail, with emphasis on the conversation scope, followed by pseudo scopes in more detail, and lastly we will provide everything needed to create our own custom scopes.

Scope types

CDI defines two different scope types, normal scope and pseudo scope, which define how a scope will function within CDI. All the built-in scopes are specified with one of these scope types, and they can also be used to create our own scope, which we will see later in the chapter.

A normal scope is declared with @NormalScope to indicate to the container that a client proxy is required. It has a single attribute, which specifies whether the ...

Get JBoss Weld CDI for Java Platform now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.