根据配置文件忽略摇摇欲坠的URL
我想根据Spring Boot应用程序中的活动配置文件忽略Swagger URL。我找到了@apiignore和@hidden,但是无论配置文件如何,它们都隐藏了API。在这里,我想隐藏一些API仅适用于产品,而不是其他配置文件(即,开发,UAT等)。有什么办法可以实现这一目标。请建议
I want to ignore the swagger URL's based on active profiles in spring boot application. I found @ApiIgnore and @Hidden, but they hide API irrespective of profile. Here, I want to hide some API's only for PROD but not other profile(i.e., DEV, UAT, etc.,). Is there a way I can achieve this. Please suggest
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它们是多种方法,一种简单的方法(但根本不是优雅)实际上是为不同的配置文件创建多个案例。
例子:
现在,在您有多个案卷的每个环境之后,您可以使用此代码行播放:
并根据每个环境的条件显示端点。
They are multiple way of doing this, one simple approach (but not elegant at all) is to actually create multiple Docket's for different profiles.
Example:
Now after you have multiple docket's per environment you can play with this line of code:
and display endpoints based on your conditions per environment.