반응형
프로젝트 생성후 dependency의 Springfox Boot Starter 추가
https://mvnrepository.com/artifact/io.springfox/springfox-boot-starter/3.0.0

테스트를 진행할 controller 생성
package com.example.swagger.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api")
public class ApiController {
@GetMapping("/hello")
public String hello() {
return "hello";
}
}
Swagger의 접속 (반드시 뒤에 "/" 를 붙여줘야 한다.) -> 해당 api의 결과를 확인할 수 있다.
http://localhost:8080/swagger-ui/

확인

반응형
'Spring > Swagger' 카테고리의 다른 글
Swagger 설정 2 (0) | 2021.07.03 |
---|---|
Swagger 개념 (0) | 2021.07.03 |