如何使用micronaut在@openapidefinition上配置动态值

发布于 2025-02-13 22:24:32 字数 786 浏览 2 评论 0原文

是否可以在@openapidefinition上具有动态值?

  • Micronaut OpenAPI中的此设置当前正在工作,我们可以显示版本和服务器上下文路径:
    在Application.Class:

    @openapidefinition( info = @info(title =“ $ {info.title}”,description =“ $ {info.description}”,版本=“ $ {info.version}”),服务器= {@server(url =“ $ {” $ { server.context-path}”)}}

    在Openapi.properties中

”在此处输入图像描述”

我的目标是:

  1. 我想使用“ micronaut.server.context-path” application.properties的值
    如果我使用“ micronaut.server.context-path”,它只是将其视为字符串文字,而不是
  2. 我想从build-info.properties使用“ build.version”值的 不动产价值
    我也想使用“ build.version”,但我没有如何在micronaut中引用该内容

Is it possible to have dynamic values on @OpenAPIDefinition?

  • This setup in Micronaut openapi is currently working, we can display the version and server context-path:

    In Application.class:

    @OpenAPIDefinition(
    info = @Info(title = "${info.title}", description = "${info.description}",version ="${info.version}"), servers = {@Server(url ="${server.context-path}")}

    In openapi.properties

enter image description here

My objectives are:

  1. I want to use the "micronaut.server.context-path" value from application.properties

    if I use "micronaut.server.context-path", it just take it as string literal, as is not the real property value
  2. I want to use the "build.version" value from build-info.properties

    I also want to use the "build.version", but I didn't how I can reference that in micronaut

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文