检查是不是配置了不止一份<context:property-placeholder location="“ />
“Spring容器是采用反射扫描的发现机制,通过标签的命名空间实例化实例,当Spring探测到容器中有一个org.springframework.beans.factory.config.PropertyPlaceholderCVonfigurer的Bean就会停止对剩余PropertyPlaceholderConfigurer的扫描,即只能存在一个实例!”
所以当context:property-placeholder标签使用了多个,Spring容器只会加载一个。当有多个外部文件要加载时使用 <context:property-placeholder location=“classpath:/jdbc.properties,classpath:/redis.properties” />
报Could not resolve placeholder 'redis.maxIdle' in string value "${redis.maxIdle}"错
最新推荐文章于 2023-10-19 20:17:46 发布