Skip to content

Instantly share code, notes, and snippets.

@AmineLAHRIM
Last active January 16, 2021 18:05
Show Gist options
  • Save AmineLAHRIM/ee4d1daf90e97dcff3192ec554c024a1 to your computer and use it in GitHub Desktop.
Save AmineLAHRIM/ee4d1daf90e97dcff3192ec554c024a1 to your computer and use it in GitHub Desktop.
// run the project
url/v2/api-docs
// swagger ui (don't forget slash at the end)
url/swagger-ui/
<!-- 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>
package com.ecomflutter.demo.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
@Configuration
public class SwaggerConfig {
@Bean
public Docket apiDocket(){
Docket docket=new Docket(DocumentationType.SWAGGER_2)
//select all routes on
.select()
// on this package
.apis(RequestHandlerSelectors.basePackage("com.ecomflutter.demo"))
.build();
return docket;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment