728x90
아래 주소에서 자신이 사용할 Swagger 버전을 찾는다.
https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui
이 글에서는 2.9.2 버전을 선택해서 사용한다
Gradle Dependency 에 추가한다
implementation group: 'io.springfox', name: 'springfox-swagger-ui', version: '2.9.2'
implementation group: 'io.springfox', name: 'springfox-swagger2', version: '2.9.2'
그리고 Swagger 를 설정할 클래스를 하나 만든다
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Bean
public Docket restAPI() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.basePackage("com.hyobin.roh"{여기에 패키지명 넣기}))
.paths(PathSelectors.any())
.build();
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("효빈의 API")
.version("1.0.0")
.description("효빈의 API 입니다")
.build();
}
}
코드 작성 및 Spring Boot 실행 후
http://localhost:8080/swagger-ui.html
접속.
동작 확인
728x90
'Server' 카테고리의 다른 글
[Vue.js] npm run build(yarn build) 후 dist 의 index.html 동작하지 않는 현상 (0) | 2022.07.06 |
---|---|
SeleniumLibrary SSH 환경 Chrome 에서 파일 다운로드 (0) | 2022.07.02 |
Ubuntu 22.0.4 + Robot + SeleniumLibrary 환경 만들기 (0) | 2022.06.30 |
Jenkins 버전 업데이트 (0) | 2022.03.06 |
Docker 이미지 <none> 태그만 골라서 몽땅 지우기 (0) | 2022.02.08 |