-
Notifications
You must be signed in to change notification settings - Fork 3
Components
Seam 2 uses as a basic building block a Component. While Java EE 6 and CDI defines a Managed Bean as basic building block.
While both Seam 2 and CDI supports definition of metadata with help of annotations, Seam 2 XML configuration was left uncovered in CDI specification.
Seam 2 | CDI | Note |
---|---|---|
Session Bean |
Session Bean |
|
Java Bean |
Managed Bean |
|
Factory method |
Producer method/field |
A producer can inject parameters into a method while Seam 2 Factory method can not |
Message-driven Bean |
Message-driven Bean |
In Seam 2 MDB may not be bound to a Seam context |
Entity Bean |
Entity Bean |
In Seam 2 Entity beans do not support bijection or context demarcation |
Resource |
Reference to a Java EE resource |
|
Component |
Portable Extension |
It may provide other kinds of beans |
Additionally there are some differences how a Managed Bean is defined in comparison to Seam 2 Component. Look in the following table.
Seam 2 component | CDI Managed Bean | Note |
---|---|---|
must have |
no need to have it |
do not have to have |
available in EL |
only if |
|
Bijection |
no bijection |
|
seam.properties or components.xml |
beans.xml |
|
explicit definition |
implicit recognition |
every Java class in the bean archive that meets certain conditions is implicitly recognized as a managed bean — no special declaration is required, while Seam 2 needs |
Seam 2 | CDI |
---|---|
name → |
name (optional) |
scope → |
scope → every scope has special annotation |
roles → |
Bean type and |
conditional installation → |
conditional installation → |
Seam 2 supports asynchronous method invocation via Dispatcher available components. Several implementations are available, like TimerService or Quartz Scheduler.
In contrast CDI does not specify asynchronous method invocation and you need to rely on EJB @Asynchronous
observer methods.
Bijection is performed dynamically via an Interceptor for every component method invocation. Bijection is bidirectional injection and outjection.
CDI doesn’t support bijection and does a static injection, which is performed only once per component lifecycle:
-
when creating contextual objects
-
injection points: constructor, field, initializer method
-
typesafe resolution — the process of matching a bean to an injection point
-
bean is assignable to a given injection point if it has a bean type that matches the required type has all the required qualifiers
-
ambiguous and unsatisfied dependency is an error
-
no outjection and disinjection
-
beans are initialized automatically
© Copyright 2015, Red Hat Middleware, LLC. All rights reserved. JBoss and Seam are registered trademarks and servicemarks of Red Hat, Inc. Privacy Policy