首页 > 解决方案 > Spring Boot YAML 中 @something.value@ 和 ${something.value} 之间的区别

问题描述

我将 spring-doc 提供的演示中的代码示例称为propertiesyaml,下面提供的代码示例。


springdoc.version= @springdoc.version@
springdoc.swagger-ui.use-root-path=true

springdoc:
  version: '@springdoc.version@'
  swagger-ui:
    use-root-path: true

我想了解提及方式@springdoc.verison@${springdoc.version}. 在 yaml 文件中使用它的标准是什么?

标签: javaspring-bootyaml

解决方案


在此处查看文档:https ://docs.spring.io/spring-boot/docs/1.4.x/reference/html/howto-properties-and-configuration.html

您将在 application.yaml 或 application.properties 中使用 @..@ 来访问在 maven 的 pom.xml 文件中定义的值。

当您的项目是成绩项目时,您将使用 ${...}。


推荐阅读