From 2ba1cbf98c75fc21481753e6156b4930c2599469 Mon Sep 17 00:00:00 2001 From: mizzio Date: Wed, 15 Nov 2023 12:44:37 +0100 Subject: [PATCH 1/4] Addedd maven war plugin --- pom.xml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 57c2dfb03..95b215648 100644 --- a/pom.xml +++ b/pom.xml @@ -154,7 +154,11 @@ true ${project.build.directory}/test-reports - + + + maven-war-plugin + 3.4.0 + org.springframework.boot spring-boot-maven-plugin From 2ffeae13d4b026c8c351b73b86217dcc896b2bd1 Mon Sep 17 00:00:00 2001 From: mwithi Date: Thu, 23 Nov 2023 00:58:30 +0100 Subject: [PATCH 2/4] Prepare for war --- pom.xml | 15 +++++---------- .../java/org/isf/OpenHospitalApiApplication.java | 3 ++- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/pom.xml b/pom.xml index 95b215648..39657115f 100644 --- a/pom.xml +++ b/pom.xml @@ -26,16 +26,6 @@ org.springframework.boot spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-tomcat - - - - - org.springframework.boot - spring-boot-starter-jetty org.springframework.boot @@ -46,6 +36,11 @@ spring-security-test test + + org.springframework.boot + spring-boot-starter-tomcat + provided + org.springframework.boot spring-boot-devtools diff --git a/src/main/java/org/isf/OpenHospitalApiApplication.java b/src/main/java/org/isf/OpenHospitalApiApplication.java index dcfea917d..012704b94 100644 --- a/src/main/java/org/isf/OpenHospitalApiApplication.java +++ b/src/main/java/org/isf/OpenHospitalApiApplication.java @@ -28,6 +28,7 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.context.ApplicationPidFileWriter; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.context.annotation.ImportResource; import com.fasterxml.jackson.databind.ObjectMapper; @@ -35,7 +36,7 @@ @ImportResource({ "classpath*:/applicationContext.xml" }) @SpringBootApplication -public class OpenHospitalApiApplication { +public class OpenHospitalApiApplication extends SpringBootServletInitializer { @Autowired private ObjectMapper objectMapper; From 278e2f919ee01f97b603d26cdfe531b4a32aa500 Mon Sep 17 00:00:00 2001 From: mwithi Date: Fri, 24 Nov 2023 09:15:06 +0100 Subject: [PATCH 3/4] Improve war and adjust swagger --- pom.xml | 11 ++++---- .../org/isf/config/OpenAPIConfiguration.java | 25 ++++++++----------- 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/pom.xml b/pom.xml index 39657115f..830f314a1 100644 --- a/pom.xml +++ b/pom.xml @@ -136,6 +136,7 @@ + oh maven-compiler-plugin @@ -149,11 +150,11 @@ true ${project.build.directory}/test-reports - - - maven-war-plugin - 3.4.0 - + + + maven-war-plugin + 3.4.0 + org.springframework.boot spring-boot-maven-plugin diff --git a/src/main/java/org/isf/config/OpenAPIConfiguration.java b/src/main/java/org/isf/config/OpenAPIConfiguration.java index 6b9de9e66..38ca90737 100644 --- a/src/main/java/org/isf/config/OpenAPIConfiguration.java +++ b/src/main/java/org/isf/config/OpenAPIConfiguration.java @@ -42,26 +42,21 @@ @Configuration @SecuritySchemes({ - @SecurityScheme( - name = "bearerAuth", - type = SecuritySchemeType.HTTP, - bearerFormat = "JWT", - scheme = "bearer" - ) + @SecurityScheme(name = "bearerAuth", type = SecuritySchemeType.HTTP, bearerFormat = "JWT", scheme = "bearer") }) public class OpenAPIConfiguration { @Bean public OpenAPI springShopOpenAPI() { return new OpenAPI().addSecurityItem( - new SecurityRequirement().addList("bearerAuth")) - .info(new Info().title("OH 2.0 Api Documentation") - .description("OH 2.0 Api Documentation") - .version("1.0").contact(new Contact().name("ApiInfo.DEFAULT_CONTACT")) - .license(new License().name("Apache 2.0").url("https://www.apache.org/licenses/LICENSE-2.0"))) - .servers(List.of(new Server().url("http://localhost:8080"))) - .components(new Components().schemas(Map.of( - "LocalDate", new DateSchema().name("LocalDate").type("string").format(null), - "LocalDateTime", new DateTimeSchema().name("LocalDateTime").type("string").format(null)))); + new SecurityRequirement().addList("bearerAuth")) + .info(new Info().title("OH 2.0 Api Documentation") + .description("OH 2.0 Api Documentation") + .version("1.0").contact(new Contact().name("ApiInfo.DEFAULT_CONTACT")) + .license(new License().name("Apache 2.0").url("https://www.apache.org/licenses/LICENSE-2.0"))) + .servers(List.of(new Server().url("http://localhost:8080/oh"))) + .components(new Components().schemas(Map.of( + "LocalDate", new DateSchema().name("LocalDate").type("string").format(null), + "LocalDateTime", new DateTimeSchema().name("LocalDateTime").type("string").format(null)))); } } \ No newline at end of file From 0aff753814755aebb159312f9c9ca541ea313a86 Mon Sep 17 00:00:00 2001 From: Alessandro Domanico Date: Thu, 30 Nov 2023 14:29:02 +0100 Subject: [PATCH 4/4] Fix workflow --- .github/workflows/maven.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 435e89e7a..2961bff93 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -53,7 +53,7 @@ jobs: - name: Run API run: | cd target - java -cp "openhospital-api-0.1.0.jar:rsc/:static/" org.springframework.boot.loader.JarLauncher & + java -cp "oh.jar:rsc/:static/" org.springframework.boot.loader.JarLauncher & sleep 60 - name: Generate OpenAPI yaml