swagger是否生成文档改成配置文件

This commit is contained in:
wulin 2020-11-27 14:17:54 +08:00
parent 11eed02309
commit 23a78f0756
5 changed files with 10 additions and 3 deletions

View File

@ -9,6 +9,7 @@
package com.lz.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;
@ -29,10 +30,13 @@ import static com.google.common.collect.Lists.newArrayList;
@EnableSwagger2
public class SwaggerConfig implements WebMvcConfigurer {
@Value(value = "${swagger.enable}")
boolean enableSwagger;
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.enable(enableSwagger)
.select()
//加了ApiOperation注解的类才生成接口文档
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))

View File

@ -267,8 +267,6 @@ public class DingtalkBusiness {
integer.setMemberCount(integer.getMemberCount() + staffs.size());
}
if(staffs.size() > 0){
for (DepartmentStaffBo departmentStaffBo:staffs
) {

View File

@ -37,6 +37,8 @@ domain:
main: "http://192.168.43.94:8001"
sms:
code: false
swagger:
enable: true
##多数据源的配置
#dynamic:

View File

@ -36,6 +36,8 @@ domain:
main: "https://lzmanagement.ldxinyong.com"
sms:
code: true
swagger:
enable: true
##多数据源的配置
#dynamic:
# datasource:

View File

@ -36,7 +36,8 @@ domain:
main: "http:/localhost"
sms:
code: false
swagger:
enable: true
##多数据源的配置
#dynamic: