【发布时间】:2016-02-22 14:35:27
【问题描述】:
在 Spring Boot 中更改属性占位符的前缀和后缀的最简单方法是什么?
默认是@Value("${some.property}"),但是这在 Kotlin 中看起来很难看,因为它需要被转义 - ${something} 是 Kotlin 中用于字符串模板的语言特性。
【问题讨论】:
-
我很确定您将无法做到这一点,因为这是在 SpEL 中定义的(继承自一般 EL)。 Kotlin 是否没有与 Groovy 的单引号“不插值”字符串等效的功能?
-
当然,你总是可以使用
@ConfigurationProperties。
标签: java spring spring-boot kotlin