80 lines
2.7 KiB
Java
80 lines
2.7 KiB
Java
|
|
package com.snp.batch.global.config;
|
||
|
|
|
||
|
|
import io.swagger.v3.oas.models.OpenAPI;
|
||
|
|
import io.swagger.v3.oas.models.info.Contact;
|
||
|
|
import io.swagger.v3.oas.models.info.Info;
|
||
|
|
import io.swagger.v3.oas.models.info.License;
|
||
|
|
import io.swagger.v3.oas.models.servers.Server;
|
||
|
|
import org.springframework.beans.factory.annotation.Value;
|
||
|
|
import org.springframework.context.annotation.Bean;
|
||
|
|
import org.springframework.context.annotation.Configuration;
|
||
|
|
|
||
|
|
import java.util.List;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Swagger/OpenAPI 3.0 설정
|
||
|
|
*
|
||
|
|
* Swagger UI 접속 URL:
|
||
|
|
* - Swagger UI: http://localhost:8081/swagger-ui/index.html
|
||
|
|
* - API 문서 (JSON): http://localhost:8081/v3/api-docs
|
||
|
|
* - API 문서 (YAML): http://localhost:8081/v3/api-docs.yaml
|
||
|
|
*
|
||
|
|
* 주요 기능:
|
||
|
|
* - REST API 자동 문서화
|
||
|
|
* - API 테스트 UI 제공
|
||
|
|
* - OpenAPI 3.0 스펙 준수
|
||
|
|
*/
|
||
|
|
@Configuration
|
||
|
|
public class SwaggerConfig {
|
||
|
|
|
||
|
|
@Value("${server.port:8081}")
|
||
|
|
private int serverPort;
|
||
|
|
|
||
|
|
@Bean
|
||
|
|
public OpenAPI openAPI() {
|
||
|
|
return new OpenAPI()
|
||
|
|
.info(apiInfo())
|
||
|
|
.servers(List.of(
|
||
|
|
new Server()
|
||
|
|
.url("http://localhost:" + serverPort)
|
||
|
|
.description("로컬 개발 서버"),
|
||
|
|
new Server()
|
||
|
|
.url("https://api.snp-batch.com")
|
||
|
|
.description("운영 서버 (예시)")
|
||
|
|
));
|
||
|
|
}
|
||
|
|
|
||
|
|
private Info apiInfo() {
|
||
|
|
return new Info()
|
||
|
|
.title("SNP Batch REST API")
|
||
|
|
.description("""
|
||
|
|
## SNP Batch 시스템 REST API 문서
|
||
|
|
|
||
|
|
Spring Batch 기반 데이터 통합 시스템의 REST API 문서입니다.
|
||
|
|
|
||
|
|
### 제공 API
|
||
|
|
- **Batch API**: 배치 Job 실행 및 관리
|
||
|
|
- **Product API**: 샘플 제품 데이터 CRUD (샘플용)
|
||
|
|
|
||
|
|
### 주요 기능
|
||
|
|
- 배치 Job 실행 및 중지
|
||
|
|
- Job 실행 이력 조회
|
||
|
|
- 스케줄 관리 (Quartz)
|
||
|
|
- 제품 데이터 CRUD (샘플)
|
||
|
|
|
||
|
|
### 버전 정보
|
||
|
|
- API Version: v1.0.0
|
||
|
|
- Spring Boot: 3.2.1
|
||
|
|
- Spring Batch: 5.1.0
|
||
|
|
""")
|
||
|
|
.version("v1.0.0")
|
||
|
|
.contact(new Contact()
|
||
|
|
.name("SNP Batch Team")
|
||
|
|
.email("support@snp-batch.com")
|
||
|
|
.url("https://github.com/snp-batch"))
|
||
|
|
.license(new License()
|
||
|
|
.name("Apache 2.0")
|
||
|
|
.url("https://www.apache.org/licenses/LICENSE-2.0"));
|
||
|
|
}
|
||
|
|
}
|