Posts

Showing posts from June, 2021

How to add swagger to spring cloud gateway microservices application

Image
 I know it is easy to add swagger to a spring boot ,Or spring MVC application. But ,what if your APIs runs behind a gateway! The following steps illustreates how configure swagger to run behind gateway Step 1: Updates on the Microservices applications 1- In the microservice project , add "io.springfox" maven to your pom.xml <!-- https://mvnrepository.com/artifact/io.springfox/springfox-boot-starter -->         <dependency>             <groupId>io.springfox</groupId>             <artifactId>springfox-boot-starter</artifactId>             <version>3.0.0</version>         </dependency> 2- in the SpringBootApplication class add annotation @EnableSwagger2 and add this bean     @Bean     public Docket api() {         return new Docket(DocumentationType.SWAGGER_2)             .select()                                             .apis(RequestHandlerSelectors.any())                         .paths(PathSelectors.any())