swagger 开关

This commit is contained in:
2024-12-26 15:42:53 +08:00
parent 2a25a4792b
commit c8cf607a72
3 changed files with 9 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
package com.sqx.config;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@@ -21,9 +22,13 @@ import static com.google.common.collect.Lists.newArrayList;
@EnableSwagger2
public class SwaggerConfig implements WebMvcConfigurer {
@Value("${swagger.enabled}")
private boolean enabled;
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.enable(enabled)
.apiInfo(apiInfo())
.select()
//加了ApiOperation注解的类才生成接口文档

View File

@@ -33,7 +33,8 @@ spring:
config:
multi-statement-allow: true
swagger:
enabled: true
pay:
h5BaseUrl: https://video-h5.hnsiyao.cn/me/detail/detail?allId=
orderNotifyUrl: https://video.hnsiyao.cn/sqx_fast/app/wuyou/notify

View File

@@ -32,7 +32,8 @@ spring:
wall:
config:
multi-statement-allow: true
swagger:
enabled: false
pay:
h5BaseUrl: https://dj-h5.hnsiyao.cn/me/detail/detail?allId=
orderNotifyUrl: https://dj-api.hnsiyao.cn/sqx_fast/app/wuyou/notify