我正在修改在应用程序上下文文件中使用Spring PropertyPlaceholderConfigurer的代码.在应用程序中成功读取和使用这些属性.但是,如果我遵循PropertyPlaceholderConfigurer声明,则会<import resource="classpath:/my/class/path/${my.file.name}" />出现" Could not resolve placeholder 'my.file.name'"错误并抛出一系列异常.在声明PropertyPlaceholderConfigurer后,属性是否立即可用?如果没有,它们何时可用?
在PropertyPlaceHolderConfigurer(BeanFactoryPostProcessor)解析属性占位符之前解析导入资源.您必须将已解析的资源名称放入导入中.
由于PropertyPlaceHolderConfigurer是一个BeanFactoryPostProcessor,因此一旦从Spring配置文件加载了bean定义就会调用它.
| 归档时间: |
|
| 查看次数: |
3310 次 |
| 最近记录: |