Reputation: 24212
suppose i have a jax-rs resource class that looks like this:
@Path("/nodes")
public class NodeResource {
//Temp - those injections should work
@EJB
ListNodesLocal nodeList;
//stuff
}
and i want some sort of lifecycle callback so i can manually lookup that field via JNDI because injection isnt working for me yet (using jboss 6 m5. see this issue : https://jira.jboss.org/browse/JBAS-8575). ideally im looking for something like
@PostConstruct
private void init() {
//manual JNDI to come here
}
can i do this somehow ? i've tried javax.annotation.PostConstruct to no avail. is there something that works?
Upvotes: 1
Views: 1660
Reputation: 9582
Since you linked to jboss in your question this answer assumes you're using the Resteasy implementation of JAX-RS. You can register interceptors to hook into the lifecycle. See here. That's how I was able to use Shiro annotations to authorize clients who want to invoke my API.
Upvotes: 1