@ConfigurationProperties前缀中的属性 [英] Property in @ConfigurationProperties prefix

查看:1085
本文介绍了@ConfigurationProperties前缀中的属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在

@ConfigurationProperties(prefix = "${domain}.user")

这不起作用。我只想用同一属性文件中另一个属性的值前缀前缀。例如:

This doesn't work. I just want to "prefix the prefix" with the value from another property from the same properties file. For example:

domain=${domain}
domain1.user.username=john
domain2.user.username=irene

所需的完整前缀为 domain1.user 使用 domain1作为 domain 属性的值进行过滤后。

The full prefix wanted would be domain1.user after filtering using "domain1" as a value for the domain property.

推荐答案

根据@ConfigurationProperties javadoc:

According to @ConfigurationProperties javadoc:

 * Note that contrary to {@code @Value}, SpEL expressions are not evaluated since property
 * values are externalized.

这篇关于@ConfigurationProperties前缀中的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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