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.
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); } }
Initialize the employee number, Hourswork,and Hoursrate to calculate a grosswage use the following condition. if…
Act as a Java developer to create a program that calculates the gross wage for…
Initialize the employee number, Hourswork,and Hoursrate to calculate a grosswage use the following condition. if…
In this tutorial, we will teach you how to create a simple school management system…
I have design the Admin Basic templete using React MUI Design Admin Dashboard and Login.Here…
In this tutorial ,i am to going teach the Laravel Breeze.Laravel Breeze provides a simple…