I Have a rest app created with Jersey framework I'm trying to inject Stateful bean into my rest controller, but this bean always is created again. I'v tested this by passing test data into this bean after printing past data, but sout always printing null.
@Stateful
public class TestService {
private String test;
public String getTest() {
return test;
}
public void setTest(String test) {
this.test = test;
}
}
@Path("/testController")
public class TestController {
@EJB
private TestService testService;
@Path("/getTest/")
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response getPage(@QueryParam("TEST")String test) {
System.out.println(testService.getTest());
testService.setTest(test);
}
}