Commit 6b9d058d by 阳浪

SwaggerConfig

parent adbfbd48
package com.yizhi.application; package com.yizhi.application;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
...@@ -18,9 +19,11 @@ import static springfox.documentation.builders.PathSelectors.regex; ...@@ -18,9 +19,11 @@ import static springfox.documentation.builders.PathSelectors.regex;
@EnableSwagger2 @EnableSwagger2
public class SwaggerConfig { public class SwaggerConfig {
@Value("${swagger.enabled}")
private boolean swaggerEnabled;
@Bean @Bean
public Docket createRestApi() { public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2) return new Docket(DocumentationType.SWAGGER_2).enable(swaggerEnabled)
.groupName("讲师库系统") .groupName("讲师库系统")
.genericModelSubstitutes(DeferredResult.class) .genericModelSubstitutes(DeferredResult.class)
.genericModelSubstitutes(ResponseEntity.class) .genericModelSubstitutes(ResponseEntity.class)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment