新增swagger开关配置
This commit is contained in:
parent
a9549d76f3
commit
d40760adc5
@ -11,6 +11,7 @@
|
||||
*/
|
||||
package io.linfeng.config;
|
||||
|
||||
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;
|
||||
@ -31,10 +32,15 @@ import java.util.List;
|
||||
@EnableSwagger2
|
||||
public class SwaggerConfig implements WebMvcConfigurer {
|
||||
|
||||
@Value("${linfeng.swagger.enable}")
|
||||
private Boolean enable;
|
||||
|
||||
|
||||
@Bean
|
||||
public Docket createRestApi(){
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.apiInfo(apiInfo())
|
||||
.enable(enable)
|
||||
.select()
|
||||
.apis(RequestHandlerSelectors.basePackage("io.linfeng"))
|
||||
.paths(PathSelectors.any())
|
||||
|
@ -34,6 +34,10 @@ spring:
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
time-zone: GMT+8
|
||||
|
||||
linfeng:
|
||||
swagger:
|
||||
enable: true
|
||||
|
||||
logging:
|
||||
level:
|
||||
io.linfeng: DEBUG
|
||||
|
@ -32,6 +32,10 @@ spring:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
|
||||
linfeng:
|
||||
swagger:
|
||||
enable: false
|
||||
|
||||
logging:
|
||||
level:
|
||||
io.linfeng: Info
|
||||
|
Loading…
Reference in New Issue
Block a user