在 application.yml 中引用一个键 [英] Reference a key in application.yml

查看:64
本文介绍了在 application.yml 中引用一个键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 application.yml 中,我如何引用此处指示的键:http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html

In application.yml, how can I reference a key indicated here: http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html

应用程序.yml

foo:
  bar: ${server.address}/verify

我希望值是 localhost/verify,但它抛出了 unresolve 占位符.

I expect that the value is localhost/verify but it is throwing unresolve placeholder.

Could not resolve placeholder 'server.address' in string value "${server.address}/verify"

推荐答案

该页面列出了您可以在 application.yml 中设置以覆盖默认值的属性.server.address 没有默认值.因此,没有定义要放入该占位符的属性.

That page lists the properties you can set within the application.yml to override defaults. The server.address doesn't have a default value. As such there is no property defined to put into that placeholder.

这篇关于在 application.yml 中引用一个键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆