Skip to content

Commit

Permalink
MVC: Remove springfox
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalgrimaud committed Dec 18, 2021
1 parent a5ccc77 commit 19f835f
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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, "<logger name=\"org.springframework.web\" level=\"WARN\"/>");
Expand All @@ -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, "<logger name=\"org.springframework.web\" level=\"WARN\"/>");
Expand All @@ -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, "<logger name=\"org.springframework.web\" level=\"WARN\"/>");
Expand All @@ -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, "<logger name=\"org.springframework.web\" level=\"WARN\"/>");
Expand All @@ -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, "<logger name=\"io.undertow\" level=\"WARN\"/>");
Expand All @@ -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, "<logger name=\"io.undertow\" level=\"WARN\"/>");
Expand Down Expand Up @@ -198,25 +187,6 @@ private void assertSpringBootStarterValidation(Project project) {
assertFileContent(project, "pom.xml", springBootStarterValidationDependency());
}

private void assertSpringFox(Project project) {
assertFileContent(project, "pom.xml", "<springfox.version>");
assertFileContent(project, "pom.xml", "</springfox.version>");
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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 19f835f

Please sign in to comment.