org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name ‘jedisConnectionFactory’ defined in class path resource [spring-redis.xml]: Could not resolve placeholder ‘redis.host’ in string value " r e d i s . h o s t " ; n e s t e d e x c e p t i o n i s j a v a . l a n g . I l l e g a l A r g u m e n t E x c e p t i o n : C o u l d n o t r e s o l v e p l a c e h o l d e r ′ r e d i s . h o s t ′ i n s t r i n g v a l u e " {redis.host}"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'redis.host' in string value " redis.host";nestedexceptionisjava.lang.IllegalArgumentException:Couldnotresolveplaceholder′redis.host′instringvalue"{redis.host}"
原因是因为Spring容器最多只能定义一个<context:property-placeholder />,其他的会被忽略掉
解决方法
<context:property-placeholder location="classpath:database.properties,classpath:redis.properties"/>