java - @Value 在第三方 jar spring boot 中的类文件中
问题描述
我正在将一个旧的基于 Spring XML 配置的应用程序迁移到 Spring Boot,并且有第三方 jars@Value("$
在其中引用了属性。我尝试加载放置/resources
在新 Spring Boot 工作区中的自定义属性文件并加载它,@PropertySource("classpath:file")
但在 Spring Boot 运行期间,该属性似乎没有被加载并得到以下错误:
Could not resolve placeholder 'com.example.propertyName' in value "${com.example.propertyName}"
at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:178)
~[spring-core-5.2.2.RELEASE.jar:5.2.2.RELEASE]
解决方案
推荐阅读
- python - 使用 tkinter 时,如何保存变量以供将来使用?
- amazon-web-services - 如何使用 aws-cdk python 设置 API 密钥
- laravel - 扩展和自定义 Laravel 重置密码逻辑
- python-3.x - 从 pdpbox 导入 pdp、get_dataset、info_plots 时出现 Python 错误
- sas - Proc sql如何使用生日提取大于18yrs的成员记录
- python - 从文件路径中提取“时间”
- javascript - 在字符串中格式化日期
- python - 如何将具有相等相邻条目的数组中的所有条目“归零”?
- r - R FlexDashboard 上的多个可视化(Leafletlet 和 Plotly)之间的交互性
- security - 无法在 IIS 8 上访问 HTTPS 站点