Spring boot

Spring boot Swagger Configuration

in this tutorial help you to learn Swagger Configuration. in earlier spring testing purpose we used postman tool. this tool is good but we have to install and and every testing need open and check it.instead of we can Swagger . it is best one just only add the dependencies  in to the pom.xml file only its works.

i attached the video below how to Configure Swagger.

you have to add these dependencies  on pom.xml.

  1. maven springfox-swagger2
  2. maven springfox-swagger-ui

 

after that you to create the package config inside the package create the class as SwaggerConfig.

inside the class paste the code.

package com.springschool.firstapp.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

@Configuration
public class SwaggerConfig {

    @Bean
    public Docket SwaggerApi()
    {
        return new Docket(DocumentationType.SWAGGER_2)
                .select()
                .apis(RequestHandlerSelectors.any())
                .paths(PathSelectors.any())
                .build();
    }


}

After that one more thing have do it.go to the main Spring boot application and paste this annotation @EnableSwagger2

i attached the full code below.

@SpringBootApplication
@EnableSwagger2
public class FirstappApplication {

 public static void main(String[] args) {
  SpringApplication.run(FirstappApplication.class, args);
 }

}

i have attached the video link below. which will do this tutorials step by step

 

 

admin

Recent Posts

ChatGPT Free Online Download the ChatGPT App Easily

Have you ever wanted to talk to a friendly, smart robot that helps you with…

4 days ago

Free GPT Chat? DeepSeek AI Does It Better

DeepSeek AI is becoming a friendly and powerful new tool in the world of artificial…

2 weeks ago

Spring Boot MySQL Complete CRUD REST API [ Free Sourecode ]

Do you want to become an expert in Spring Boot CRUD operations? This comprehensive tutorial…

2 weeks ago

CREATE Responsive Navigation Bar with FlexBox CSS!

Modern websites must have a navigation bar that is clear and responsive. FlexBox CSS is…

4 weeks ago

Registration with image upload Java Jdbc(Download Source code)

Introduction In this section, we will guide you step by step in the development of an image upload registration system in Java using MySQL and JDBC. In the application, users register…

2 months ago

Touchable shop Pos system using Java

The Touchable Shop POS (Point of Sale) system is a sophisticated software solution developed using…

3 months ago