默认情况下,Spring容器仅允许最多定义一个PropertyPlaceholderConfigurer
或 <content:property-placeholder>
,如果有多个属性文件,先扫描到的被保留,其余的会被Spring忽略
解决办法:
在所有PropertyPlaceholderConfigurer
或 <content:property-placeholder>
配置中加上<property name="ignoreUnresolvablePlaceholders" value="true"/>
配置(告诉Spring容器扫描到这个属性文件后,可以继续往下扫描一个属性文件),就可以扫描到所有的属性文件。
spring的context:property-placeholder标签和PropertyPlaceholderConfigurer的bean配置
最新推荐文章于 2023-07-30 13:37:33 发布