|
1 | 1 | package com.api.advanced_mobile.global.config; |
2 | 2 |
|
3 | | -import io.swagger.v3.oas.annotations.OpenAPIDefinition; |
4 | | -import io.swagger.v3.oas.annotations.servers.Server; |
5 | | -import io.swagger.v3.oas.models.Components; |
6 | 3 | import io.swagger.v3.oas.models.OpenAPI; |
7 | 4 | import io.swagger.v3.oas.models.info.Info; |
| 5 | +import io.swagger.v3.oas.models.servers.Server; |
8 | 6 | import org.springframework.context.annotation.Bean; |
9 | 7 | import org.springframework.context.annotation.Configuration; |
10 | 8 |
|
| 9 | +import java.util.List; |
11 | 10 |
|
12 | | -@OpenAPIDefinition( |
13 | | - servers = { |
14 | | - @Server(url = "https://api.13.209.194.63.nip.io", description = "https 서버입니다."), |
15 | | - @Server(url = "http://api.13.209.194.63.nip.io", description = "http 서버입니다."), |
16 | | - @Server(url = "http://localhost:8080", description = "local 서버입니다.") |
17 | | - } |
18 | | -) |
19 | 11 | @Configuration |
20 | 12 | public class SwaggerConfig { |
21 | 13 |
|
22 | 14 | @Bean |
23 | 15 | public OpenAPI openAPI() { |
| 16 | + // HTTPS 서버만 명시 |
| 17 | + Server httpsServer = new Server(); |
| 18 | + httpsServer.setUrl("https://api.13.209.194.63.nip.io"); |
| 19 | + httpsServer.setDescription("Production HTTPS Server"); |
| 20 | + |
| 21 | + // 로컬 서버 (개발용) |
| 22 | + Server localServer = new Server(); |
| 23 | + localServer.setUrl("http://localhost:8080"); |
| 24 | + localServer.setDescription("Local Development Server"); |
| 25 | + |
24 | 26 | Info info = new Info() |
25 | 27 | .title("API Document") |
26 | 28 | .version("v0.0.1") |
27 | 29 | .description("API 명세서입니다."); |
28 | 30 |
|
29 | 31 | return new OpenAPI() |
30 | 32 | .info(info) |
31 | | - .components(new Components()); |
| 33 | + .servers(List.of(httpsServer, localServer)); |
32 | 34 | } |
33 | 35 | } |
0 commit comments