1
假设我有一个看起来像这样的JAX-RS资源类:JAX-RS资源的生命周期回调?
@Path("/nodes")
public class NodeResource {
//Temp - those injections should work
@EJB
ListNodesLocal nodeList;
//stuff
}
,我想某种生命周期的回调,所以我可以手动通过JNDI查找该领域,因为注射心不是为我工作,但(使用JBoss 6 m5。看到这个问题:https://jira.jboss.org/browse/JBAS-8575)。 理想即时寻找类似
@PostConstruct
private void init() {
//manual JNDI to come here
}
我能做到这一点不知?我试过javax.annotation.PostConstruct无济于事。有什么可行吗?