From 19f835f555dc19967d2036eb2a93fd43d69b527f Mon Sep 17 00:00:00 2001 From: Pascal Grimaud Date: Sat, 18 Dec 2021 19:46:34 +0100 Subject: [PATCH] MVC: Remove springfox --- .../mvc/web/domain/SpringBootMvc.java | 5 ---- .../domain/SpringBootMvcDomainService.java | 14 --------- .../SpringBootMvcApplicationServiceIT.java | 30 ------------------- .../mvc/web/domain/SpringBootMvcTest.java | 5 ---- 4 files changed, 54 deletions(-) diff --git a/src/main/java/tech/jhipster/lite/generator/server/springboot/mvc/web/domain/SpringBootMvc.java b/src/main/java/tech/jhipster/lite/generator/server/springboot/mvc/web/domain/SpringBootMvc.java index f099dde7d27..dd41cc9c709 100644 --- a/src/main/java/tech/jhipster/lite/generator/server/springboot/mvc/web/domain/SpringBootMvc.java +++ b/src/main/java/tech/jhipster/lite/generator/server/springboot/mvc/web/domain/SpringBootMvc.java @@ -4,15 +4,10 @@ public class SpringBootMvc { - private static final String SPRINGFOX_VERSION = "3.0.0"; private static final String PROBLEM_SPRING_VERSION = "0.27.0"; private SpringBootMvc() {} - public static String springfoxVersion() { - return SPRINGFOX_VERSION; - } - public static String problemSpringVersion() { return PROBLEM_SPRING_VERSION; } diff --git a/src/main/java/tech/jhipster/lite/generator/server/springboot/mvc/web/domain/SpringBootMvcDomainService.java b/src/main/java/tech/jhipster/lite/generator/server/springboot/mvc/web/domain/SpringBootMvcDomainService.java index c6521a4d49a..9f3c78c5103 100644 --- a/src/main/java/tech/jhipster/lite/generator/server/springboot/mvc/web/domain/SpringBootMvcDomainService.java +++ b/src/main/java/tech/jhipster/lite/generator/server/springboot/mvc/web/domain/SpringBootMvcDomainService.java @@ -49,9 +49,7 @@ public void init(Project project) { @Override public void addSpringBootMvc(Project project) { buildToolService.addDependency(project, springBootStarterWebDependency()); - addSpringfoxDependencyAndProperty(project); - addMvcPathmatchInProperties(project); addServerPortInProperties(project); addExceptionHandler(project); addLoggerInConfiguration(project, "org.springframework.web", Level.WARN); @@ -61,9 +59,7 @@ public void addSpringBootMvc(Project project) { public void addSpringBootUndertow(Project project) { buildToolService.addDependency(project, springBootStarterWebDependency(), List.of(tomcatDependency())); buildToolService.addDependency(project, undertowDependency()); - addSpringfoxDependencyAndProperty(project); - addMvcPathmatchInProperties(project); addServerPortInProperties(project); addExceptionHandler(project); addLoggerInConfiguration(project, "io.undertow", Level.WARN); @@ -109,16 +105,6 @@ private void templateToExceptionHandler(Project project, String source, String t projectRepository.template(project, getPath(SOURCE, type), sourceFilename, getPath(destination, source, EXCEPTION_HANDLER_PATH)); } - private void addSpringfoxDependencyAndProperty(Project project) { - buildToolService.addDependency(project, springfoxDependency()); - buildToolService.addProperty(project, "springfox", springfoxVersion()); - } - - private void addMvcPathmatchInProperties(Project project) { - springBootPropertiesService.addProperties(project, "spring.mvc.pathmatch.matching-strategy", "ant_path_matcher"); - springBootPropertiesService.addPropertiesTest(project, "spring.mvc.pathmatch.matching-strategy", "ant_path_matcher"); - } - private void addServerPortInProperties(Project project) { springBootPropertiesService.addProperties(project, "server.port", getServerPort(project)); springBootPropertiesService.addPropertiesTest(project, "server.port", 0); diff --git a/src/test/java/tech/jhipster/lite/generator/server/springboot/mvc/web/application/SpringBootMvcApplicationServiceIT.java b/src/test/java/tech/jhipster/lite/generator/server/springboot/mvc/web/application/SpringBootMvcApplicationServiceIT.java index e58e39f88e3..6be29e09200 100644 --- a/src/test/java/tech/jhipster/lite/generator/server/springboot/mvc/web/application/SpringBootMvcApplicationServiceIT.java +++ b/src/test/java/tech/jhipster/lite/generator/server/springboot/mvc/web/application/SpringBootMvcApplicationServiceIT.java @@ -40,9 +40,7 @@ void shouldInit() { springBootMvcApplicationService.init(project); assertTomcat(project); - assertSpringFox(project); - assertMvcPathmatch(project); assertFileContent(project, getPath(MAIN_RESOURCES, "config", APPLICATION_PROPERTIES), "server.port=8080"); assertFileContent(project, getPath(TEST_RESOURCES, "config", APPLICATION_PROPERTIES), "server.port=0"); assertLoggingConfiguration(project, ""); @@ -61,9 +59,7 @@ void shouldAddSpringBootMvc() { springBootMvcApplicationService.addSpringBootMvc(project); assertTomcat(project); - assertSpringFox(project); - assertMvcPathmatch(project); assertFileContent(project, getPath(MAIN_RESOURCES, "config", APPLICATION_PROPERTIES), "server.port=8080"); assertFileContent(project, getPath(TEST_RESOURCES, "config", APPLICATION_PROPERTIES), "server.port=0"); assertLoggingConfiguration(project, ""); @@ -83,9 +79,7 @@ void shouldAddSpringBootMvcWithServerPort() { springBootMvcApplicationService.addSpringBootMvc(project); assertTomcat(project); - assertSpringFox(project); - assertMvcPathmatch(project); assertFileContent(project, getPath(MAIN_RESOURCES, "config", APPLICATION_PROPERTIES), "server.port=7419"); assertFileContent(project, getPath(TEST_RESOURCES, "config", APPLICATION_PROPERTIES), "server.port=0"); assertLoggingConfiguration(project, ""); @@ -106,7 +100,6 @@ void shouldAddSpringBootMvcWithInvalidServerPort() { assertTomcat(project); - assertMvcPathmatch(project); assertFileContent(project, getPath(MAIN_RESOURCES, "config", APPLICATION_PROPERTIES), "server.port=8080"); assertFileContent(project, getPath(TEST_RESOURCES, "config", APPLICATION_PROPERTIES), "server.port=0"); assertLoggingConfiguration(project, ""); @@ -126,8 +119,6 @@ void shouldAddSpringBootUndertow() { assertUndertow(project); - assertMvcPathmatch(project); - assertFileContent(project, getPath(MAIN_RESOURCES, "config", APPLICATION_PROPERTIES), "server.port=8080"); assertFileContent(project, getPath(TEST_RESOURCES, "config", APPLICATION_PROPERTIES), "server.port=0"); assertLoggingConfiguration(project, ""); @@ -147,9 +138,7 @@ void shouldAddSpringBootUndertowWithServerPort() { springBootMvcApplicationService.addSpringBootUndertow(project); assertUndertow(project); - assertSpringFox(project); - assertMvcPathmatch(project); assertFileContent(project, getPath(MAIN_RESOURCES, "config", APPLICATION_PROPERTIES), "server.port=1664"); assertFileContent(project, getPath(TEST_RESOURCES, "config", APPLICATION_PROPERTIES), "server.port=0"); assertLoggingConfiguration(project, ""); @@ -198,25 +187,6 @@ private void assertSpringBootStarterValidation(Project project) { assertFileContent(project, "pom.xml", springBootStarterValidationDependency()); } - private void assertSpringFox(Project project) { - assertFileContent(project, "pom.xml", ""); - assertFileContent(project, "pom.xml", ""); - assertFileContent(project, "pom.xml", springFoxDependency()); - } - - private void assertMvcPathmatch(Project project) { - assertFileContent( - project, - getPath(MAIN_RESOURCES, "config", APPLICATION_PROPERTIES), - "spring.mvc.pathmatch.matching-strategy=ant_path_matcher" - ); - assertFileContent( - project, - getPath(TEST_RESOURCES, "config", APPLICATION_PROPERTIES), - "spring.mvc.pathmatch.matching-strategy=ant_path_matcher" - ); - } - private void assertExceptionHandlerProperties(Project project) { assertFileContent( project, diff --git a/src/test/java/tech/jhipster/lite/generator/server/springboot/mvc/web/domain/SpringBootMvcTest.java b/src/test/java/tech/jhipster/lite/generator/server/springboot/mvc/web/domain/SpringBootMvcTest.java index 172ea8d45c0..e9ea1045cc3 100644 --- a/src/test/java/tech/jhipster/lite/generator/server/springboot/mvc/web/domain/SpringBootMvcTest.java +++ b/src/test/java/tech/jhipster/lite/generator/server/springboot/mvc/web/domain/SpringBootMvcTest.java @@ -9,11 +9,6 @@ @UnitTest class SpringBootMvcTest { - @Test - void shouldGetSpringfoxVersionVersion() { - assertThat(SpringBootMvc.springfoxVersion()).isEqualTo("3.0.0"); - } - @Test void shouldGetProblemSpringVersion() { assertThat(SpringBootMvc.problemSpringVersion()).isEqualTo("0.27.0");