From 93991beef59e88fc040d293a3fc28505d1acc4df Mon Sep 17 00:00:00 2001 From: Mariana Azevedo Date: Thu, 30 Jul 2020 00:52:45 -0300 Subject: [PATCH] Fixing the updates of Swagger dependencies to version 3.0.0. --- Procfile | 2 +- README.md | 10 +++---- pom.xml | 29 ++++++++----------- .../util/config/SwaggerConfiguration.java | 13 +++++++-- .../resources/application-prod.properties | 2 +- .../resources/application-test.properties | 2 +- src/main/resources/application.properties | 3 +- 7 files changed, 32 insertions(+), 29 deletions(-) diff --git a/Procfile b/Procfile index 4d437d5..2a6043c 100644 --- a/Procfile +++ b/Procfile @@ -1 +1 @@ -web: java -jar -Dspring.profiles.active=prod -Dserver.port=$PORT target/financial-java-api-3.0.2-SNAPSHOT.jar \ No newline at end of file +web: java -jar -Dspring.profiles.active=prod -Dserver.port=$PORT target/financial-java-api-3.0.3-SNAPSHOT.jar \ No newline at end of file diff --git a/README.md b/README.md index 0e7cf95..2a0a2ec 100644 --- a/README.md +++ b/README.md @@ -158,14 +158,14 @@ All `BigDecimal` values always contain exactly two decimal places, eg: `15.385` This project was developed with: * **Java 11 (Java Development Kit - JDK: 11.0.7)** -* **Spring Boot 2.3.0** +* **Spring Boot 2.3.2** * **Spring Admin Client 2.2.3** * **Maven** * **JUnit 5** * **Surfire** * **PostgreSQL 12** * **Flyway 6.4.1** -* **Swagger 2.10.5** +* **Swagger 3.0.0** * **Model Mapper 2.3.8** * **Heroku** * **EhCache** @@ -179,7 +179,7 @@ The API also was developed to run with an `jar`. In order to generate this `jar` mvn package ``` -It will clean, compile and generate a `jar` at target directory, e.g. `financial-java-api-3.0.2-SNAPSHOT.jar` +It will clean, compile and generate a `jar` at target directory, e.g. `financial-java-api-3.0.3-SNAPSHOT.jar` ### Execution @@ -217,7 +217,7 @@ mvn integration-test In order to run the API, run the jar simply as following: ```bash -java -jar financial-java-api-3.0.2-SNAPSHOT.jar --spring.profiles.active=prod +java -jar financial-java-api-3.0.3-SNAPSHOT.jar --spring.profiles.active=prod ``` or @@ -230,7 +230,7 @@ By default, the API will be available at [http://localhost:8080/financial/v1](ht ### Documentation -* Swagger (development environment): http://localhost:8080/swagger-ui.html +* Swagger (development environment): http://localhost:8080/swagger-ui/index.html #### Medium Articles diff --git a/pom.xml b/pom.xml index ee0a23c..36143a8 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ io.github.mariazevedo88 financial-java-api - 3.0.2-SNAPSHOT + 3.0.3-SNAPSHOT jar financial-java-api @@ -21,7 +21,7 @@ 11 - 2.10.5 + 3.0.0 2.3.8 4.10.0 2.2.3 @@ -68,6 +68,16 @@ org.springframework.boot spring-boot-starter-actuator + + io.springfox + springfox-boot-starter + ${swagger.version} + + + de.codecentric + spring-boot-admin-starter-client + ${spring.admin.version} + org.projectlombok lombok @@ -87,16 +97,6 @@ org.flywaydb flyway-core - - io.springfox - springfox-swagger2 - ${swagger.version} - - - io.springfox - springfox-swagger-ui - ${swagger.version} - org.modelmapper modelmapper @@ -115,11 +115,6 @@ bucket4j-core ${bucket4j.version} - - de.codecentric - spring-boot-admin-starter-client - ${spring.admin.version} - diff --git a/src/main/java/io/github/mariazevedo88/financialjavaapi/util/config/SwaggerConfiguration.java b/src/main/java/io/github/mariazevedo88/financialjavaapi/util/config/SwaggerConfiguration.java index aaf1c50..aac3f88 100644 --- a/src/main/java/io/github/mariazevedo88/financialjavaapi/util/config/SwaggerConfiguration.java +++ b/src/main/java/io/github/mariazevedo88/financialjavaapi/util/config/SwaggerConfiguration.java @@ -1,5 +1,6 @@ package io.github.mariazevedo88.financialjavaapi.util.config; +import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; @@ -10,7 +11,7 @@ import springfox.documentation.service.ApiInfo; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; -import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc; +import springfox.documentation.swagger2.annotations.EnableSwagger2; /** * Class that implements the necessary settings for using Swagger as an API documentation tool. @@ -20,9 +21,15 @@ */ @Configuration @Profile({"dev"}) -@EnableSwagger2WebMvc +@EnableSwagger2 public class SwaggerConfiguration { + @Value("${release.version}") + private String releaseVersion; + + @Value("${api.version}") + private String apiVersion; + /** * Method that configure all the endpoint's mapped in the documentation. * @@ -49,7 +56,7 @@ public Docket api() { */ private ApiInfo apiInfo() { return new ApiInfoBuilder().title("Financial Java API") - .description("Financial Java API - Endpoint's documentation").version("1.0.0") + .description("Financial Java API - Endpoint's documentation").version(releaseVersion.concat("_").concat(apiVersion)) .build(); } diff --git a/src/main/resources/application-prod.properties b/src/main/resources/application-prod.properties index 77db2bc..e6123fa 100644 --- a/src/main/resources/application-prod.properties +++ b/src/main/resources/application-prod.properties @@ -18,7 +18,7 @@ pagination.items_per_page=10 jwt.secret=oioqowepjsjdasd!$%mknfskdnf090192019 jwt.expiration=6000 -api.version=2020-07-29 +api.version=2020-07-30 api.key="FX001-FREE" #Enable response compression diff --git a/src/main/resources/application-test.properties b/src/main/resources/application-test.properties index cd17291..aa64db5 100644 --- a/src/main/resources/application-test.properties +++ b/src/main/resources/application-test.properties @@ -14,7 +14,7 @@ spring.cache.jcache.config=classpath:cache/ehcache.xml spring.mvc.throw-exception-if-no-handler-found=true spring.mvc.resources.add-mappings=false -api.version=2020-07-29 +api.version=2020-07-30 api.key="FX001-FREE" #Enable response compression diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index ba3f0ea..1e9e252 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -21,7 +21,8 @@ pagination.items_per_page=10 jwt.secret=qweernadnamdn19820918209!#ajhad jwt.expiration=3600 -api.version=2020-07-29 +release.version=3.0.3 +api.version=2020-07-30 api.key="FX001-FREE" #Enable response compression