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無濟於事。有什麼可行嗎?