Chapter 4. Components and contexts
This chapter covers
This chapter introduces the components and contexts that Seam manages. If you’ve worked with the Spring Framework, the idea of declaring managed objects should be familiar to you. In Seam, however, you replace all uses of the word bean with the word component. Like Spring, Seam boasts similar capabilities to define, configure, and instantiate components. In one regard, you can think of Seam as a lightweight container. It doesn’t force you to code to container-specific interfaces, require you to adopt a special programming model, or mandate that your components even live in a container. Instead, components are just plain old Java objects (POJOs). What makes Seam unique is that it leverages existing containers and contexts to host the objects it instantiates, so it’s more accurately classified as a meta-container. After obtaining an instance of a component, Seam decorates it with enterprise services that are applied transparently through the use of method interceptors. The main advantage that Seam has over other managed containers such as Spring is that Seam treats a component’s context with equal importance as the component itself. Thus, the focus of this chapter is not just components, but rather contextual components.