何时调用标有@PostConstruct 的方法? [英] When method marked with @PostConstruct called?

查看:50
本文介绍了何时调用标有@PostConstruct 的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在JSF请求处理生命周期的哪个阶段,@PostConstruct标记的backing bean方法被调用?

At which phase of the JSF request processing lifecycle, the backing bean method marked with @PostConstruct called?

推荐答案

@PostConstruct 标记的方法将在 bean 创建、依赖项注入、所有托管属性设置后调用, 在 bean 被实际设置到作用域之前.

Methods marked with the @PostConstruct will be invoked after the bean has been created, dependencies have been injected, all managed properties are set, and before the bean is actually set into scope.

找到相关SO线程,可能不完全相同,但它回答了您的问题.还有一篇博客文章解释了同样的内容.

Found related SO thread, might not be exactly same but it answers your question. And a blog entry explaining the same.

这篇关于何时调用标有@PostConstruct 的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆