@ManagedProperty注射后@PostConstruct [英] @ManagedProperty injected AFTER @PostConstruct

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

问题描述

这个问题已经解决的MyFaces的2.1执行

THIS PROBLEM IS ALREADY SOLVED IN THE MYFACES 2.1 IMPLEMENTATION

我有一个正确传递一个整数参数,像这样的链接:

I have a link which passes an Integer parameter properly like this:

<h:link outcome="/process/createProcess">
    <f:param name="id" value="#{process.idprocess}" />
    Edit
</h:link>

它变为createProcess.xhtml ID = 21?正确,我也请求范围内支持bean的CreateProcess这个code:

It goes to "createProcess.xhtml?id=21" properly, and I have this code in the request scope backing Bean createProcess:

@ManagedProperty(value="#{param.id}")
private Integer idProcess;

private Process newProcess;

@PostConstruct
public void init()
{
    log();
    if (idProcess!=null)
        newProcess = Dao.getProcessDAO().get(idProcess);
    else
        newProcess = new Process();
}

我注意到 idProcess 总是空。调试后,我意识到,setIdProcess方法被调用的 @PostConstruct

I've notice that idProcess is always null. After debugging I realized that setIdProcess method is called AFTER @PostConstruct.

据我所知,注入只是bean的建设完成后,所有的managedProperties都可以在 @PostConstruct

I understand that injection is done just after the construction of the bean and all the managedProperties are available in @PostConstruct.

我是什么失踪?

推荐答案

仅供参考,我觉得在这个职位的问题的 MyFaces的-3116 ,与已经固定,所以2.0.6,2.1.0和上层版本没有它。

Just for reference, I think the issue in this post is MYFACES-3116, with was already fixed at , so 2.0.6, 2.1.0 and upper versions does not have it.

这篇关于@ManagedProperty注射后@PostConstruct的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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