♻️ Refactoring code.add property to control swagger enabled or disabled
This commit is contained in:
1 parent
e477418bc4
commit
8da5ade1f4
3 files changed
+7
No files matched your search
+2
@@ -21,6 +21,7 @@ import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Predicates;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
@@ -44,6 +45,7 @@ import java.util.List;
|
||||
@Configuration
|
||||
@EnableSwagger2
|
||||
@EnableAutoConfiguration
|
||||
@ConditionalOnProperty(name = "swagger.enabled", matchIfMissing = true)
|
||||
public class SwaggerAutoConfiguration {
|
||||
|
||||
/**
|
||||
|
||||
+4
@@ -32,6 +32,10 @@ import java.util.List;
|
||||
@Data
|
||||
@ConfigurationProperties("swagger")
|
||||
public class SwaggerProperties {
|
||||
/**
|
||||
* 是否开启swagger
|
||||
*/
|
||||
private Boolean ebabled;
|
||||
/**
|
||||
* swagger会解析的包路径
|
||||
**/
|
||||
|
||||
@@ -25,6 +25,7 @@ spring:
|
||||
|
||||
# swagger相关配置,覆盖全局配置
|
||||
swagger:
|
||||
enabled: false
|
||||
authorization:
|
||||
authorization-scope-list:
|
||||
- scope: 'server'
|
||||
|
||||
Reference in new issue
Block a user