java - spring 中的@Profile 注解可以使用占位符吗?
问题描述
spring 中的@Profile 注解可以使用占位符吗?
我想要 @Profile 注释,但里面的值是 ${spring.profile.active} ,它是使用占位符获得的。这有用吗?
@Configuration
@Profile("${spring.profile.active:local}")
public class Config {
}
我想知道 ${spring.profile.active} 是否可以正确获取值?
谢谢!
解决方案
Spring @Profile 不支持 SPEL 从属性中获取值。使用带有属性占位符值的 @Profile 注释中提出的相同问题
推荐阅读
- sql - 如何使用 T-SQL 将我现有的表转换为这种特定格式?
- python - USB 摄像头的 OpenCV 采集错误,但 VideoCapture 实例仍处于打开状态
- solr - Apache Solr 词级 ngram
- visual-studio-code - Visual Studio Code 不适用于 WSL2
- css - CSS - 弹性网格之间的边距
- python - 如何使用带有调度时间的python在excel中输入日期?
- machine-learning - 无法理解线性回归中从一个方程到另一个方程的转换。(来自第 2 章,统计学习的要素)
- azure - Azure DevOps - 发布任务自动设置为“作用于资源组''”
- python-3.x - 如何在视频python中检测到对象(人)时获取时间
- r - 居中标记饼图的标签段起点