Dear Team,
@Path("/pet")
@Api(value = "/pet", description = "Operations about pets")
@Produces({"application/json", "application/xml"})
@Stateless
public class PetResource {
static PetData petData = new PetData();
static JavaRestResourceUtil ru = new JavaRestResourceUtil();
@EJB
private HelloWorld hWorld; // EJB injection
......
.......
public Response getPetById(
@ApiParam(value = "ID of pet that needs to be fetched", allowableValues = "range[1,5]", required = true) @PathParam("petId") String petId)
throws NotFoundException {
System.out.println("hWorld " + hWorld); // Returns null i.e injection does not happen
}
HelloWorld EJB:-
===============
package com.wordnik.swagger.sample.ejb;
import javax.ejb.Stateless;
@Stateless
public class HelloWorld {
public void hello(String name) {
System.out.println("Hello " + name);
}
}