• Home
  • Docker
  • Kubernetes
  • LLMs
  • Java
  • Ubuntu
  • Maven
  • Big Data
  • Archived
Samples | Swagger Sample Application (Swagger 3, OpenAPI 3, swagger-ui-dist 4.15.5, Jersey, Jakarta, Tomcat)
  1. The application structure
  2. The POM file (pom.xml)
  3. web.xml
  4. OpenAPI document (openapi.json)
  5. MyResourceConfig.java
  6. Swagger/REST service: MyEntitySwaggerAPI.java
  7. Java entity: MyEntity.java
  8. Build and test the swagger application

  1. The application structure
    mtitek-swagger-samples-eclipse

    Notes:
    • You can download swagger-ui-dist from: https://www.npmjs.com/package/swagger-ui-dist

    • Extract the content of the file: swagger-ui-dist-4.15.5.tgz

    • Copy the content of the directory "package" in the folder: "mtitek-swagger-samples/src/main/webapp"

    • Open the file "src/main/webapp/swagger-initializer.js"
      Change: url: "https://petstore.swagger.io/v2/swagger.json",
      With: url: "http://localhost:8080/mtitek-swagger-samples-1.0.0-SNAPSHOT/swagger.json",
  2. The POM file (pom.xml)
  3. web.xml
    src/main/webapp/WEB-INF/web.xml:
  4. OpenAPI document (openapi.json)
    src/main/resources/openapi.json:
  5. MyResourceConfig.java
  6. Swagger/REST service: MyEntitySwaggerAPI.java
  7. Java entity: MyEntity.java
  8. Build and test the swagger application
    Apache Maven: mvn clean package

    Apache Tomcat: deploy the war file "mtitek-swagger-samples-1.0.0-SNAPSHOT.war" in the folder "${TOMCAT_ROOT}/webapps/"

    In your browser type the following URL: http://localhost:8080/mtitek-swagger-samples-1.0.0-SNAPSHOT

    mtitek-swagger-samples-eclipse
© 2025  mtitek