< the groupId > IO. Springfox < / groupId > < artifactId > springfox - the boot - starter < / artifactId > < version > 3.0.0 < / version > < / dependency >Copy the code

package org.fh.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.oas.annotations.EnableOpenApi; import springfox.documentation.service.ApiInfo; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; / * *

FH Admin from fhadmin.cn */ public class SwaggerConfig {FH Admin from fhadmin.cn */ public class SwaggerConfig {

public Docket createRestApi() { return new Docket(DocumentationType.OAS_30) .apiInfo(apiInfo()) .select() Apis (RequestHandlerSwww.cungun.com electors. BasePackage (org. Fh. “controller”)) / / for the current package path. The paths (PathSelectors. Any ()) .build(); } private ApiInfo ApiInfo () {return new ApiInfoBuilder().title(“FH Admin Swagger3 RESTful API”) // Page swim page title .version(“3.0”) // version number.description (“fhadmin.org”) // description.build (); } } package org.fh.config; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; / * *

Swagger intercepting pAGER configuration Admin from fhadmin.cn */ public class WebMvcConfig implements WebMvcConfigurer {FH Admin from fhadmin.cn */ public class WebMvcConfig implements WebMvcConfigurer {

www.cungun.com

public void addResourceHandlers(ResourceHandlerRegistry registry) { registry. addResourceHandler(“/swagger-ui/**”) .addResourceLocations(“classpath:/META-INF/resources/webjars/springfox-swagger-ui/”) .resourceChain(false); } public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController(“/swagger-ui/”) .setViewName(“forward:/swagger-ui/index.html”); }