Swagger Tutorial in Hindi | Documenting Rest API with swagger | Swagger tutorial for beginners hindi

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 ต.ค. 2024
  • Swagger Tutorial in Hindi or Documenting Rest APIs with swagger | | Swagger tutorial for beginners Hindi - This video will show you what all dependency required and code change required to implement swagger for your controller or Rest endpoints. This swagger tutorial in hindi is specially designer for beginners developer and very much used in industry.
    Swagger Config Class:
    @Configuration
    @EnableSwagger2
    public class SwaggerConfig extends WebMvcConfigurerAdapter {
    @Value("${project.version}")
    private String version;
    @Value("${user.swagger.baseurl}")
    private String baseUrl;
    @Override
    public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
    configurer.enable();
    }
    @Bean
    public Docket swaggerPlugin(ServletContext servletContext) {
    Docket docket = new Docket(DocumentationType.SWAGGER_2)
    .apiInfo(apiInfo())
    .select()
    .apis(RequestHandlerSelectors.any())
    .paths(regex("/*.*"))
    .paths(not(regex("/error.*")))
    .build()
    .pathProvider(new RelativePathProvider(servletContext) {
    @Override
    public String getApplicationBasePath() {
    return baseUrl;
    }
    });
    docket.tags(new Tag("User Management", "Endpoints for user user management"));
    docket.useDefaultResponseMessages(false);
    return docket;
    }
    private ApiInfo apiInfo() {
    return new ApiInfoBuilder()
    .title("User APIs")
    .description("API endpoints for user")
    .version(version)
    .build();
    }
    }
    or can visit the below url:
    github.com/roh...
    Dependency : Available in comment box also as angle brackets not allowed here or you can visit the link:
    github.com/roh...
    Properties File:
    project:
    version: @project.version@
    server:
    port: 8081
    spring:
    data:
    mongodb:
    database: user-management
    profiles:
    active: dev

    ---
    spring:
    profiles: dev
    data:
    mongodb:
    uri: mongodb://localhost:27017
    user:
    swagger:
    baseurl: /user
    For details visit the below link:
    github.com/roh...
    Thanks for watching !! Happy Coding !!
    Subscribe the channel by clicking the below link :
    • Swagger Tutorial in Hi...
    Full Code with project available here : Branch : feature/swagger-lombok
    github.com/roh...
    #SwaggerTutorialInHindi
    #HowToCode
    #RohitKinshu

ความคิดเห็น • 25