Chapter 36. Migration from Seam 2 to Java EE and Alternatives
- 36.1. Initialization and life cycle callbacks
- 36.2. Scopes and contexts
- 36.3.
@Install - 36.4. Entities
- 36.5.
@Startup - 36.6. Special injection
- 36.7. XML Configuration
- 36.8. Events
- 36.9. Interceptors
- 36.10. Seam Navigation migration to JSF
- 36.11. Seam 2 UI controls migration to JSF
- 36.12. Seam 2 components
- 36.13. Security
This chapter details migration of Seam 2 to Java EE 6 and, where Java EE 6 is lacking, to alternatives such as DeltaSpike.
36.1. Initialization and life cycle callbacks
Seam 2 supports standard
@PostConstruct and @PreDestroy annotations for designating post-initialization and pre-destruction callbacks. Seam 2 also provides Seam-specific alternatives (@Create and @Destroy) with identical semantics.
CDI only supports the standard annotations. If you are using the Seam-specific annotations in a legacy application, the easiest solution is to replace them with the standard ones.
The advantage of using CDI is that it provides richer initialization facilities such as:
- dependency injection using the bean constructor (which allows for using dependency injection in immutable objects)
- dependency injection using initializer methods
For more details, see the CDI specification.