下面的代码有效
@POST
@Path("/{apiId}")
@Consumes(MediaType.APPLICATION_JSON)
public Response postMetricsData(String metricsData) {
System.out.println(metricsData);
return Response.ok().build();
}
下面的代码抛出错误
@POST
@Path("/{apiId}")
@Consumes(MediaType.APPLICATION_JSON)
public Response postMetricsData(String metricsData, @PathParam("apiId") String apiId) {
System.out.println(metricsData);
return Response.ok().build();
}
低于异常
rg.glassfish.jersey.server.model.ModelValidationException: Validation of the application resource model has failed during application initialization.
[[致命] 找不到公共 javax.ws.rs.core.Response com.trimble.paas.apicloud.metricscollector.resource.MetricsResource.postMetricsData(java.lang.String,java.lang.String) 类型参数的注入源) 在索引 1 处。source='ResourceMethod{httpMethod=POST,consumedTypes=[application/json],producedTypes=[],suspended=false,suspendTimeout=0,suspendTimeoutUnit=MILLISECONDS,invocable=Invocable{handler=ClassBasedMethodHandler{handlerClass=class com.trimble.paas .apicloud.metricscollector.resource.MetricsResource,handlerConstructors=[org.glassfish.jersey.server.model.HandlerConstructor@59916e0f]},definitionMethod=public javax.ws.rs.core.Response com.trimble.paas.apicloud.metricscollector。 resource.MetricsResource.postMetricsData(java.lang.String,java.lang.String), parameters=[Parameter [type=class java.lang.String, source=null,
关于我缺少什么的任何想法?