优化api配置
This commit is contained in:
parent
3a988177d1
commit
12171b120c
|
@ -20,6 +20,7 @@
|
||||||
*/
|
*/
|
||||||
package net.mingsoft.config;
|
package net.mingsoft.config;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
@ -38,10 +39,13 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||||
@ConditionalOnProperty(prefix="ms",name = "swagger-enable", havingValue = "true")
|
@ConditionalOnProperty(prefix="ms",name = "swagger-enable", havingValue = "true")
|
||||||
public class SwaggerConfig {
|
public class SwaggerConfig {
|
||||||
|
|
||||||
|
@Value("${ms.manager.path}")
|
||||||
|
private String mangerPath ;
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public Docket api() {
|
public Docket api() {
|
||||||
return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select()
|
return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select()
|
||||||
.apis(RequestHandlerSelectors.basePackage("net.mingsoft")).paths(PathSelectors.any())
|
.apis(RequestHandlerSelectors.basePackage("net.mingsoft")).paths(PathSelectors.regex("^((?!("+mangerPath+"|static)).)+$"))
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue