私のサービスで問題が発生しています。 以下は私のサービスMultivalueMapを使用したポストコールの問題
@POST
@Path("/config")
@Consumes(MediaType.APPLICATION_JSON)
public Response saveConfiguration(String name, MultivaluedMap<String,
Object> properties) {
return Response.ok().build();
}
ですそして、私のテストケースは次のとおりです。
String payload = "{"name": "CRJ001",
"properties": {"expression": ["a + b"],
"baseClass": ["org.carlspring.strongbox.crontask.test.MyTask"]}}";
WebTarget resource = client.getClientInstance().target(path);
Response response = resource.request(MediaType.APPLICATION_JSON).
post(Entity.entity(payload, MediaType.APPLICATION_JSON));
int status = response.getStatus();
assertEquals("Failed to save!", Response.ok().build().getStatus(), status);
しかし、私は取得しています:
[[FATAL] Method public javax.ws.rs.core.Response org.abc.rest.ConfigurationRestlet.
saveConfiguration(java.lang.String,javax.ws.rs.core.MultivaluedMap)
on resource class org.abc.rest.ConfigurationRestlet contains multiple
parameters with no annotation. Unable to resolve the injection source.;
私に助けてください、このうち、あなたは何
'org.abc.rest.ConfigurationRestlet'とは何ですか? –
休憩サービスクラス – Yougesh
パラメータ 'name'にJAX-RSアノテーションを使用する必要があります。要求のどの部分がマップされていますか? –