Hi all,
I am having problems integrating guice in jersey. Basically when I try to
populate the bean "DefaultRole" (interface "Role") using injection with
@InjectParam the implementation class "DefaultRole" gets instantiated, but
not populated. When I leave out @InjectParam and just use the implementation
class directly in the method signature instead of the interface, it works
perfectly.
This is the request that I am sending off via POST:
{"id":12345,"permissions":["READ_XX","WRITE_XX"]}
The following implementation DOES NOT work where I am using the bean
interface as the parameter:
@POST
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Role processLogin(@InjectParam Role role) throws JSONException
{
System.out.println(role);
return role;
}
The following implementation WORKS where I am using the bean implementation
as the parameter:
@POST
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Role processLogin(DefaultRole role) throws JSONException
{
System.out.println(role);
return role;
}
Unfortunately this is of course not what I want because I want to be able to
use my interfaces and have them injected via jersey/guice.
Can anyone help me on this? What could I be doing wrong?
Thanks and best regards,
Michael