此内容没有您所选择的语言版本。

29.3. Annotations for component lifecycle methods


These annotations allow a component to react to its own lifecycle events. They occur on methods of the component. Only one of these annotations may be used in any one component class.
@Create
@Create
Copy to Clipboard Toggle word wrap
Specifies that the method should be called when an instance of the component is instantiated by Seam. Create methods are only supported for JavaBeans and stateful session beans.
@Destroy
@Destroy
Copy to Clipboard Toggle word wrap
Specifies that the method should be called when the context ends and its context variables are destroyed. Destroy methods are only supported for JavaBeans and stateful session beans.
Destroy methods should be used only for cleanup. Seam catches, logs and swallows any exception that propagates out of a destroy method.
@Observer
@Observer("somethingChanged")
Copy to Clipboard Toggle word wrap
Specifies that the method should be called when a component-driven event of the specified type occurs.
@Observer(value="somethingChanged",create=false)
Copy to Clipboard Toggle word wrap
Specifies that the method should be called when an event of the specified type occurs, but that an instance should not be created if it does not already exist. If an instance does not exist and create is set to false, the event will not be observed. The default value is true.
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat