优化api配置

This commit is contained in:
msgroup 2021-08-08 15:24:11 +08:00
parent 3a988177d1
commit 12171b120c
1 changed files with 5 additions and 1 deletions

View File

@ -20,6 +20,7 @@
*/
package net.mingsoft.config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@ -38,10 +39,13 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
@ConditionalOnProperty(prefix="ms",name = "swagger-enable", havingValue = "true")
public class SwaggerConfig {
@Value("${ms.manager.path}")
private String mangerPath ;
@Bean
public Docket api() {
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();
}