mirror of
https://gitee.com/likeadmin/likeadmin_java.git
synced 2026-06-25 14:37:40 +08:00
增加: Swagger开关配置项
This commit is contained in:
@@ -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(){
|
||||
|
||||
Reference in New Issue
Block a user