0
내 나머지 API를 문서화하기 위해 swagger를 사용하고 있습니다.비어있는 값을 가진 메서드를 선택하지 않음
예 :
@RequestMapping(value = "/abc/api/fruit", produces = "application/json")
@Controller
@Api(value = "Fruit", description = "api for fruits", produces = "application/json")
public class FruitResource {
@RequestMapping(method = RequestMethod.GET, value = "")
@ResponseBody
@ApiOperation(httpMethod = "GET", value = "Resource to get fruits", produces = "application/json", notes = "get fruits", response=Fruit.class)
public ResponseEntity<Fruit> getFruits() throws Exception {
return new ResponseEntity<Fruit>(someServiceCallToGetFruits(), HttpStatus.OK);
}
}
상기
바와 같이, 상기 방법은 비어의 상기 RequestMapping
value
("").
이 때문에이 클래스와 메서드는 스 래거에 의해 선택되지 않습니다.
그러나 나는 아래에 방법 위의 RequestMapping 라인을 변경할 때 : 그것은 작업을 시작
@RequestMapping(method = RequestMethod.GET, value = "/")
.
이것은 버그입니까? ""
경로 값을 사용하려면 어떻게해야할까요? 나는 위의 모든 메소드 위에 "/"
을 넣고 싶지 않습니다.
당신이 빈 값을 지정하지하려고 있나요? '@RequestMapping (method = RequestMethod.GET)'또는'@GetMapping()'처럼? –
스프링 애노테이션 인'@ RequestMapping'이 여기에 있습니까? 또한 value = "/"와 함께 작동 할 때 swagger에 표시된 전체 경로는 무엇입니까? – nullpointer
@AlekseiBudiak : 그 덕분에 .. 감사합니다 !! – Nik