java我怎样才能隐藏在产品配置文件中的狂妄自大?
我试图在SwaggerConfig
类上添加一个profile annotation
我用过!本地测试,看看它是否工作,然后我将它改为:!刺激
@profile("!local")
这是注释前的img before
这是注释后的img after
我想有什么东西在触发Swagger
。帮帮我:(
我的配置类
@Profile("!local")
@EnableSwagger2
@Configuration
public class SwaggerConfig{
@Bean
public Docket swaggerConfiguration() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.basePackage("private packageName"))
.paths(PathSelectors.regex("/.*"))
.build());
}
我的应用程序是yml文件
spring:
profiles:
active: local
# 1 楼答案
这段代码应该可以帮助您在prod中隐藏swagger ui