【发布时间】:2021-09-13 09:27:49
【问题描述】:
我尝试在SwaggerConfig 类上添加profile annotation。
我用 !local 进行测试,看看它是否有效,然后我将其更改为:!prod
@profile("!local")
注解前的这张图片 before
注解后的这张图片 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
【问题讨论】:
-
您应该向我们展示您的配置文件以及您如何启动/编译您的应用,以查看您的
Spring确实考虑了您的个人资料。 -
@Pilpo 我已编辑
标签: java spring swagger swagger-ui profile