mtitek
  • Cloud
  • Big Data
  • CI
  • Install
  • Samples
  • Java
  • Ubuntu
  • Maven
  • Archive
Samples | Swagger UI: Sample Application (Swagger, Jersey, Spring)
  1. The application structure
  2. The POM file (pom.xml)
  3. web.xml
  4. MyResourceConfig.java
  5. Swagger/REST service: MyEntitySwaggerAPI.java
  6. Java entity: MyEntity.java
  7. Build and test the swagger application

  1. The application structure
    mtitek-swagger-sample-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-3.24.0.tgz

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

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

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

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

    mtitek-swagger-sample-eclipse
© 2020  mtitek