could not resolve placeholder ‘redis.host1’ in string value “${redis.host1}”

本人花费半年的时间总结的《Java面试指南》已拿腾讯等大厂offer,已开源在github ,欢迎star!

本文GitHub https://github.com/OUYANGSIHAI/JavaInterview 已收录,这是我花了6个月总结的一线大厂Java面试总结,本人已拿大厂offer,欢迎star

原文链接:blog.ouyangsihai.cn >> could not resolve placeholder ‘redis.host1’ in string value “${redis.host1}”

原因:spring 的配置文件2处地方导入了配置文件

Spring容器仅允许最多定义一个PropertyPlaceholderConfigurer(或 <context:property-placeholder />),其余的会被Spring忽略掉.

解决:

一次性导入多个配置文件


<context:property-placeholder location="classpath:jdbc.properties,classpath:redis.properties" system-properties-mode="NEVER"/>

或者


<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> 
 <property name="locations"> 
 <list> 
 <value>classpath:jdbc.properties</value> 
 <value>classpath:jdbc2.properties</value> 
 </list> 
 </property> 
</bean>

转自:https://zhangguodong.me/2016/03/12/rediserror/

本人花费半年的时间总结的《Java面试指南》已拿腾讯等大厂offer,已开源在github ,欢迎star!

本文GitHub https://github.com/OUYANGSIHAI/JavaInterview 已收录,这是我花了6个月总结的一线大厂Java面试总结,本人已拿大厂offer,欢迎star

原文链接:blog.ouyangsihai.cn >> could not resolve placeholder ‘redis.host1’ in string value “${redis.host1}”


 上一篇
Tomcat部署没有问题,但是一直报错404 Tomcat部署没有问题,但是一直报错404
url中的路径应该跟context配置保持一致1、url中的路径 2、context路径设置 以上设置就是最简洁的设置检查方式,最常见的问题是只修改了url的路径没有修改context的路径,因此报了404。 这个是从网上看到的,当时就是
下一篇 
windows系统关闭某个端口的服务 windows系统关闭某个端口的服务
利用下面命令查询例如查询,404端口。 netstat -ano | findstr 443 就发现是5624进程占用了,所以关掉即可!