[Swagger 초기 적용]
This commit is contained in:
		
							
								
								
									
										26
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								README.md
									
									
									
									
									
								
							@@ -8,6 +8,7 @@
 | 
				
			|||||||
- **Security**: Spring Security + JWT
 | 
					- **Security**: Spring Security + JWT
 | 
				
			||||||
- **Build Tool**: Gradle
 | 
					- **Build Tool**: Gradle
 | 
				
			||||||
- **Container**: Docker + Kubernetes
 | 
					- **Container**: Docker + Kubernetes
 | 
				
			||||||
 | 
					- **API Documentation**: Swagger (SpringDoc OpenAPI)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## 개발 가이드
 | 
					## 개발 가이드
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -31,7 +32,30 @@ src/main/java/com/bio/bio_backend/
 | 
				
			|||||||
└── BioBackendApplication.java
 | 
					└── BioBackendApplication.java
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### 2. 트랜잭션 관리
 | 
					### 2. API 문서화 (Swagger)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#### Swagger UI 접속
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- **URL**: `http://localhost:8080/service/swagger-ui.html`
 | 
				
			||||||
 | 
					- **API Docs**: `http://localhost:8080/service/api-docs`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#### 주요 어노테이션
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```java
 | 
				
			||||||
 | 
					@Tag(name = "Member", description = "회원 관리 API")
 | 
				
			||||||
 | 
					@Operation(summary = "회원 가입", description = "새로운 회원을 등록합니다.")
 | 
				
			||||||
 | 
					@ApiResponses(value = {
 | 
				
			||||||
 | 
					    @ApiResponse(responseCode = "201", description = "회원 가입 성공"),
 | 
				
			||||||
 | 
					    @ApiResponse(responseCode = "400", description = "잘못된 요청 데이터")
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#### 설정 파일
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- **SwaggerConfig.java**: OpenAPI 기본 정보 설정
 | 
				
			||||||
 | 
					- **application.properties**: Swagger UI 커스터마이징
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### 3. 트랜잭션 관리
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### 기본 설정
 | 
					#### 기본 설정
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -61,6 +61,9 @@ dependencies {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	// p6spy
 | 
						// p6spy
 | 
				
			||||||
	implementation 'com.github.gavlyukovskiy:p6spy-spring-boot-starter:1.9.0'
 | 
						implementation 'com.github.gavlyukovskiy:p6spy-spring-boot-starter:1.9.0'
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						// SpringDoc OpenAPI (Swagger)
 | 
				
			||||||
 | 
						implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.9'
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
tasks.named('test') {
 | 
					tasks.named('test') {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -0,0 +1,31 @@
 | 
				
			|||||||
 | 
					package com.bio.bio_backend.global.config;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import io.swagger.v3.oas.models.OpenAPI;
 | 
				
			||||||
 | 
					import io.swagger.v3.oas.models.info.Info;
 | 
				
			||||||
 | 
					import io.swagger.v3.oas.models.info.Contact;
 | 
				
			||||||
 | 
					import io.swagger.v3.oas.models.info.License;
 | 
				
			||||||
 | 
					import io.swagger.v3.oas.models.servers.Server;
 | 
				
			||||||
 | 
					import org.springframework.context.annotation.Bean;
 | 
				
			||||||
 | 
					import org.springframework.context.annotation.Configuration;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Configuration
 | 
				
			||||||
 | 
					public class SwaggerConfig {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Bean
 | 
				
			||||||
 | 
					    public OpenAPI openAPI() {
 | 
				
			||||||
 | 
					        return new OpenAPI()
 | 
				
			||||||
 | 
					                .info(new Info()
 | 
				
			||||||
 | 
					                        .title("대상 미생물 분석 시스템 Backend API")
 | 
				
			||||||
 | 
					                        .description("대상 미생물 분석 시스템 Backend 서비스의 REST API 문서")
 | 
				
			||||||
 | 
					                        .version("v1.0.0")
 | 
				
			||||||
 | 
					                        .license(new License()
 | 
				
			||||||
 | 
					                                .name("STAM License")
 | 
				
			||||||
 | 
					                                .url("https://stam.kr/")))
 | 
				
			||||||
 | 
					                .servers(List.of(
 | 
				
			||||||
 | 
					                        new Server().url("http://localhost:8080/service").description("Local Development Server"),
 | 
				
			||||||
 | 
					                        new Server().url("https://api.bio.com/service").description("Production Server")
 | 
				
			||||||
 | 
					                ));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -54,3 +54,11 @@ token.expiration_time_access=180000
 | 
				
			|||||||
token.expiration_time_refresh=604800000
 | 
					token.expiration_time_refresh=604800000
 | 
				
			||||||
token.secret_key= c3RhbV9qd3Rfc2VjcmV0X3Rva2Vuc3RhbV9qd3Rfc2VjcmV0X3Rva2Vu
 | 
					token.secret_key= c3RhbV9qd3Rfc2VjcmV0X3Rva2Vuc3RhbV9qd3Rfc2VjcmV0X3Rva2Vu
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Swagger 설정
 | 
				
			||||||
 | 
					springdoc.api-docs.path=/api-docs
 | 
				
			||||||
 | 
					springdoc.swagger-ui.path=/swagger-ui.html
 | 
				
			||||||
 | 
					springdoc.swagger-ui.operationsSorter=method
 | 
				
			||||||
 | 
					springdoc.swagger-ui.tagsSorter=alpha
 | 
				
			||||||
 | 
					springdoc.swagger-ui.doc-expansion=none
 | 
				
			||||||
 | 
					springdoc.swagger-ui.disable-swagger-default-url=true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user