![](/img/trans.png)
[英]Jersey JAX-RS, Swagger - getting swagger.json generated but no UI
[英]Exclude methods of jax-rs service from swagger.json
我在Java EE7應用程序(Glassfish作為應用程序服務器)上使用了swagger。 除了使用FormDataParam的方法,其他一切都正常,這給了我傳統的錯誤:
org.glassfish.jersey.server.ContainerException: java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.AnnotationIntrospector.findPropertyIndex(Lcom/fasterxml/jackson/databind/introspect/Annotated;)Ljava/lang/Integer;
我嘗試了所有方法,但這只是一個方法,所以我不想在我的swagger.json中非常討厭此方法
如何才能從招搖中排除此方法。 我試過了:
@ApiModelProperty(hidden = true) and @ApiOperation(value="",hidden = true)
@POST
@Path("something")
@Produces(MediaType.TEXT_PLAIN)
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public Response newsomething(@FormParam("something") String something,@Context HttpServletRequest request, @Context HttpServletResponse response) throws IOException {
return "something";
}
我做錯了什么?
與Glassfish有關,它使用了不同版本的Jackson。 您需要升級Glassfish / Jackson。 更多細節:
java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.AnnotationIntrospector.findPropertyIndex(Lcom/fasterxml/jackson/databind/introspect/Annotated;)Ljava/lang/Integer
solution https://github.com/swagger-api/swagger -核心/問題/ 1001 java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.AnnotationIntrospector.findPropertyIndex(Lcom/fasterxml/jackson/databind/introspect/Annotated;)Ljava/lang/Integer;
解決方案-https://groups.google.com/forum/#!topic/swagger - swaggersocket/uQEn - anX_Og java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.AnnotationIntrospector.findPropertyDesc
解決方案https://groups.google.com/forum/#!topic/swagger-swaggersocket/x-Pz_3orTCE 對我來說,在可用的路徑中添加@ApiModelProperty(hidden = true)是錯誤還是正確的?
@ApiModelProperty(hidden = true)
@GET
@Produces({MediaType.APPLICATION_JSON})
@ApiOperation(value = "return getApi ",
tags = {"getApi"},
notes = "Returns a Array of getApi",
hidden = true
)
@ApiResponses(value = {
@ApiResponse(response = GetApi.class, message = "", code = 200)
})
@Path("getApi")
public Response getApi(@Context HttpHeaders httpHeaders, @BeanParam QueryParamBean queryParamBean) {
// codes..
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.