Skip to content

Lifecycle Callbacks

LightGuard edited this page Jan 25, 2012 · 3 revisions

Initialization and lifecycle callbacks

Seam 2 supports standard @PostConstruct and @PreDestroy annotations for designating post-initialization and pre-destruction callbacks. Besides, Seam-specific alternatives (@Create and @Destroy) with identical semantics are supported.

CDI only supports the standard annotations. If using the Seam-specific ones in a legacy application, the easiest solution is to replace them with the standard ones.

Besides, CDI provides richer initialization facilities such as

  • dependency injection using the bean constructor (which allow for using dependency injection in immutable objects)
  • dependency injection using initializers methods

See the CDI specification for more details.

Clone this wiki locally