java 何时调用标有@PostConstruct 的方法?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4061935/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
When method marked with @PostConstruct called?
提问by siva636
At which phase of the JSF request processing lifecycle, the backing bean method marked with @PostConstruct called?
在JSF请求处理生命周期的哪个阶段,@PostConstruct标记的backing bean方法被调用?
回答by Adeel Ansari
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.
标记为 的方法@PostConstruct
将在创建 bean、注入依赖项、设置所有托管属性之后以及在 bean 实际设置到作用域之前调用。
Found related SO thread, might not be exactly same but it answers your question. And a blog entryexplaining the same.