Furthermore, @Resource
annotation might not work. Try this
@javax.ws.rs.core.Context
ServletContext context;
The injection doesn't happen until you hit the service method
public class MyService {
@Context ServletContext context;
public MyService() {
print("Constructor " + context); // null here
}
@GET
@Path("/thing") {
print("in wizard service " + context); // available here
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…