增加: Swagger开关配置项

This commit is contained in:
TinyAnts
2023-03-15 15:23:51 +08:00
parent c84b597032
commit 58999e6fbc
6 changed files with 52 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
package com.mdd.front.config;
import com.mdd.common.config.GlobalConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
@@ -14,14 +15,21 @@ import springfox.documentation.spring.web.plugins.Docket;
@EnableOpenApi
public class SwaggerConfig {
@Value("${like.swagger.enabled}")
private boolean enabled;
@Value("${like.swagger.pathMapping}")
private String pathMapping;
@Bean
public Docket createRestApi(){
return new Docket(DocumentationType.OAS_30)
.apiInfo(apiInfo())
.enable(true)
.enable(enabled)
.select()
.apis(RequestHandlerSelectors.basePackage("com.mdd.front"))
.build();
.build()
.pathMapping(pathMapping);
}
private ApiInfo apiInfo(){