Spent some time on searching, found few similar links but still couldn't able to solve this.
Finally, posting in here, hoping someone will share information on how to accomplish below
Goal: Inject objects having constructor with arguments.
@Path("/test")
@Produces({MediaType.APPLICATION_JSON})
public class DummyApi {
// with count = 1
public DummyObject dummyObj1;
// with count = 2
public DummyObject dummyObj2;
@Inject
public DummyApi(@CountVal(1) DummyObject dObj1, @CountVal(2) DummyObject dObj2) {
this.dummyObj1 = dObj1;
this.dummyObj2 = dObj2;
}
@GET @Path("/invoke")
public String invoke()
{
return "";
}
}
public class DummyObject
{
private int count;
@Inject
public DummyObject (int value)
{
this.count = value;
}
}