Skip to content

Commit

Permalink
πŸ“ docs: Swagger 적용 (#77)
Browse files Browse the repository at this point in the history
πŸ“ docs: Swagger 적용 (#77)
  • Loading branch information
DDonghyeo authored May 27, 2024
2 parents f46c052 + 37d7a5d commit b271744
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 20 deletions.
1 change: 1 addition & 0 deletions apiGateway-service/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ FROM openjdk:17-jdk

ARG JAR_FILE=build/libs/*.jar
COPY ${JAR_FILE} app.jar
COPY src/main/resources/static /app/static
ENTRYPOINT ["java", "-Dspring.profiles.active=prod", "-Duser.timezone=Asia/Seoul" , "-jar", "app.jar"]
2 changes: 2 additions & 0 deletions apiGateway-service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-security'
testImplementation 'org.springframework.security:spring-security-test'

// Swagger
implementation 'org.springdoc:springdoc-openapi-starter-webflux-ui:2.1.0'

// //Spring Boot Actuator
// implementation 'org.springframework.boot:spring-boot-starter-actuator'
Expand Down
24 changes: 22 additions & 2 deletions apiGateway-service/src/main/resources/bootstrap.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
server:
port: 80
port: 443

spring:
application:
Expand All @@ -22,8 +22,28 @@ eureka:
service-url:
defaultZone: http://localhost:8761/eureka


springdoc:
# api-docs:
# enabled: true
# version: openapi_3_0
swagger-ui:
use-root-path: true
urls:
- url: /noti/v3/api-docs
name: Notification Service
- url: /weather/v3/api-docs
name: Weather Service
- url: /user/v3/api-docs
name: User Service
# path: /swagger-ui.html
# version: 3.0.0



#management: # Actuator Settings
# endpoints:
# web:
# exposure:
# include: refresh, health, beans, httptrace
# include: refresh, health, beans, httptrace

22 changes: 11 additions & 11 deletions noti-service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ plugins {
id 'java'
id 'org.springframework.boot' version '3.2.3'
id 'io.spring.dependency-management' version '1.1.4'
id "org.springdoc.openapi-gradle-plugin" version '1.8.0'
// id "org.springdoc.openapi-gradle-plugin" version '1.8.0'
}

group = 'com.waither'
Expand Down Expand Up @@ -62,16 +62,16 @@ dependencies {
testImplementation 'org.assertj:assertj-core:3.23.1'
}

openApi {
apiDocsUrl.set("http://localhost:80") // Document URL
outputDir.set(file("$rootDir/build/docs")) // Build Result Path
outputFileName.set("noti.json") // Build Result File Name
groupedApiMappings.set(Map.of("http://localhost:8082/noti/api-docs", "noti.json"))
waitTimeInSeconds.set(60) // Timeout
customBootRun {
args.add("--spring.profiles.active=dev")
}
}
//openApi {
// apiDocsUrl.set("http://localhost:80") // Document URL
// outputDir.set(file("$rootDir/build/docs")) // Build Result Path
// outputFileName.set("noti.json") // Build Result File Name
// groupedApiMappings.set(Map.of("http://localhost:8082/noti/api-docs", "noti.json"))
// waitTimeInSeconds.set(60) // Timeout
// customBootRun {
// args.add("--spring.profiles.active=dev")
// }
//}

dependencyManagement {
imports {
Expand Down
12 changes: 11 additions & 1 deletion noti-service/src/main/resources/bootstrap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,14 @@ eureka:
register-with-eureka: true # register to eureka server
fetch-registry: true # Getting instances' information from eureka server
service-url:
defaultZone : http://localhost:8761/eureka #Eureka Server's address
defaultZone : http://127.0.0.1:8761/eureka #Eureka Server's address

springdoc:
api-docs:
version: openapi_3_0
enabled: true
path: /noti/v3/api-docs
default-consumes-media-type: application/json
default-produces-media-type: application/json
enable-spring-security: true

11 changes: 10 additions & 1 deletion user-service/src/main/resources/bootstrap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,13 @@ eureka:
# endpoints:
# web:
# exposure:
# include: busrefresh
# include: busrefresh

springdoc:
api-docs:
version: openapi_3_0
enabled: true
path: /user/v3/api-docs
default-consumes-media-type: application/json
default-produces-media-type: application/json
enable-spring-security: true
19 changes: 14 additions & 5 deletions weather-service/src/main/resources/bootstrap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,17 @@ eureka:
service-url:
defaultZone : http://localhost:8761/eureka #Eureka Server's address

management: # Actuator
endpoints:
web:
exposure:
include: busrefresh
#management: # Actuator
# endpoints:
# web:
# exposure:
# include: busrefresh

springdoc:
api-docs:
version: openapi_3_0
enabled: true
path: /noti/v3/api-docs
default-consumes-media-type: application/json
default-produces-media-type: application/json
enable-spring-security: true

0 comments on commit b271744

Please sign in to comment.