티스토리 뷰

Development/Error

swagger NullPointerException Error

쥬리리리 2023. 7. 6. 13:17

swagger 2 -> 3로 업그레이드 진행하면서 프로젝트 띄울 때 

 

[springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper.scanDocumentation:98] - Unable to scan documentation context default
java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because "this.id" is null

 

해당 에러가 발생했다.

 

라이브러리가 겹치는게 있어서 그런지 이것저것 해보다가 결국은 swagger 버전이 올라가면서 에노테이션 변경으로 인한 문제였다.

 

기존 사용하던 @ApiModelProperty을 모두 @Schema로 변경하니 서버 띄울 때 문제없이 올라간다.

 

[ swagger 2 -> 3 차이점 ]

//어노테이션
@ApiParam -> @Parameter	
@ApiOperation -> @Operation
@Api -> @Tag
@ApiImplicitParams -> @Parameters
@ApiImplicitParam -> @Parameter
@ApiIgnore -> @Parameter(hidden = true) or @operation(hidden = true) or @hidden
@apimodel -> @Schema
@ApiModelProperty -> @Schema

//파라미터
value -> description
tags -> name

 

댓글
링크
최근에 올라온 글
Total
Today
Yesterday