From c39a53467e570ba16f7f0c4243bfda020a88bf1e Mon Sep 17 00:00:00 2001 From: merxgrc Date: Tue, 16 Sep 2025 22:35:13 -0700 Subject: [PATCH] Adds springdoc api dependencies to the pom.xml file, adds swagger-ui custom path to maven-wrapper.properties, adds redirectView to root endpoint in RootController.java --- .mvn/wrapper/maven-wrapper.properties | 6 ++++++ pom.xml | 5 +++++ .../inventory/controller/RootController.java | 15 +++------------ 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties index 44f3cf2..bf273a7 100644 --- a/.mvn/wrapper/maven-wrapper.properties +++ b/.mvn/wrapper/maven-wrapper.properties @@ -1,2 +1,8 @@ distributionType=only-script distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.11/apache-maven-3.9.11-bin.zip +# swagger-ui custom path +springdoc.swagger-ui.path=/swagger-ui.html +# /api-docs endpoint custom path +springdoc.api-docs.path=/api-docs + + diff --git a/pom.xml b/pom.xml index 0b348cb..ee8d6fe 100644 --- a/pom.xml +++ b/pom.xml @@ -65,6 +65,11 @@ 2.2.224 test + + org.springdoc + springdoc-openapi-starter-webmvc-ui + 2.8.13 + diff --git a/src/main/java/com/mrxgrc/inventory/controller/RootController.java b/src/main/java/com/mrxgrc/inventory/controller/RootController.java index 18ecffb..56f978e 100644 --- a/src/main/java/com/mrxgrc/inventory/controller/RootController.java +++ b/src/main/java/com/mrxgrc/inventory/controller/RootController.java @@ -2,6 +2,7 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.servlet.view.RedirectView; import java.util.Map; @@ -9,17 +10,7 @@ public class RootController { @GetMapping("/") - public Map getRoot() { - return Map.of( - "message", "Hello World! Welcome to the Inventory API", - "endpoints", Map.of( - "items", "/items", - "getItemById", "/items/{id}", - "createItem", "POST /items", - "updateItem", "PUT /items/{id}", - "deleteItem", "DELETE /items/{id}", - "health", "/health" - ) - ); + public RedirectView redirectToSwagger() { + return new RedirectView("/swagger-ui/index.html"); } }