Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

API Documentation with ReDoc and Spring boot

Could someone share some examples on how to implement API Documentation using ReDoc along with SpringBoot framework. It would be great help if someone knows some good examples with ReDoc + Springboot.

like image 402
Varun Avatar asked Jul 31 '26 01:07

Varun


1 Answers

You can create a spring boot application enabling springdoc-openapi-ui [1] and then add a static html [2] as shown in here! by changing spec-url as http://localhost:8080/v3/api-docs [3]

[1] : https://www.baeldung.com/spring-rest-openapi-documentation

[2] : https://stackoverflow.com/a/42393332/878710

[3] :

<!DOCTYPE html>
<html>
  <head>
    <title>Redoc</title>
    <!-- needed for adaptive design -->
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700" rel="stylesheet">

    <!--
    Redoc doesn't change outer page styles
    -->
    <style>
      body {
        margin: 0;
        padding: 0;
      }
    </style>
  </head>
  <body>
    <redoc spec-url='http://localhost:8080/v3/api-docs'></redoc>
    <script src="https://cdn.jsdelivr.net/npm/redoc@latest/bundles/redoc.standalone.js"> </script>
  </body>
</html>
like image 138
ozkansari Avatar answered Aug 03 '26 17:08

ozkansari