首先,Spring容器会加载多个<context:property-placeholder location=""/>,但是取值的时候只会在第一个<context:property-placeholder location=""/>加载的文件中去寻找key名字。

所以,在配置context:property-placeholder 时,应在一个中配置,多个文件使用逗号分割开;例如:<context:property-placeholder location="classpath:config.properties,classpath:ipParameters.properties"/>

正确配置:<context:property-placeholder location="classpath:config.properties,classpath:ipParameters.properties"/>

错误配置:<context:property-placeholder location="classpath:config.properties"/>

<context:property-placeholder location="classpath:ipParameters.properties"/>

错误提示:

23:32:03,115 [RMI TCP Connection(3)-127.0.0.1] INFO  [org.springframework.context.support.PropertySourcesPlaceholderConfigurer] - Loading properties file from class path resource [config.properties]
2017-08-08 23:32:03,134 [RMI TCP Connection(3)-127.0.0.1] INFO  [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@64bbe1ee: defining beans [org.springframework.context.support.PropertySourcesPlaceholderConfigurer#0,org.springframework.context.support.PropertySourcesPlaceholderConfigurer#1,HBAdContentService,HBAdminService,HBCategoryService,
2017-08-08 23:32:03,135 [RMI TCP Connection(3)-127.0.0.1] ERROR [org.springframework.web.context.ContextLoader] - Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'ipParamters' defined in class path resource [spring.xml]: Could not resolve placeholder 'tableUrl' in string value "${tableUrl}" 

关于spring配置文件context:property-placeholder相关推荐

  1. 通过Spring配置文件中bean中的property赋值

    基本数据类型赋值-通过spring配置文件中bean中的property 扩展-以此方式可以通过配置为连接数据的属性赋值 1.如果是基本数据类型,可以通过setter方法为对象中的属性设置初始值,应用 ...

  2. Spring配置文件applicationContext.xml中bean>>property>>name属性的含义

    Spring配置文件applicationContext.xml中bean>>property>>name属性表示的含义 首先我们知道property是bean元素的子元素,它 ...

  3. spring中context:property-placeholder标签详解

    spring中context:property-placeholder标签的使用说明 1,有些参数在某些阶段中是常量. 在开发阶段我们连接数据库时的url,username,password等信息 分 ...

  4. 转 spring配置文件

    spring配置文件 pom文件: <properties><commons-lang.version>2.6</commons-lang.version>< ...

  5. spring配置文件import标签中使用${}占位符获得配置文件的属性值

    2019独角兽企业重金招聘Python工程师标准>>> 一般情况下我们在Spring的配置文件中使用<import>标签是这样的,<import resource= ...

  6. (转)使用Spring配置文件实现事务管理

    http://blog.csdn.net/yerenyuan_pku/article/details/52886207 前面我们讲解了使用Spring注解方式来管理事务,现在我们就来学习使用Sprin ...

  7. XML配置文件的命名空间与Spring配置文件中的头

    一直以来,写Spring配置文件,都是把其他配置文件的头拷贝过来,最多改改版本号,也不清楚哪些是需要的,到底是干嘛的.今天整理一下,拒绝再无脑copy. 一.Spring配置文件常见的配置头 < ...

  8. spring配置文件中分别使用多个properties文件

    spring配置文件中分别使用多个properties文件 在使用spring时,有时候需要为了模块配置方便有时候需要针对不同的模块建立不同的applicationContext的配置文件,然后在对应 ...

  9. JAVA spring配置文件总结

    首先来看一个标准的Spring配置文件 applicationContext.xml <?xml version="1.0" encoding="UTF-8&quo ...

最新文章

  1. [C] 深度优先搜索解决连通块/染色问题——求岛的个数
  2. xray 被动_长亭xray:一款自动化Web漏洞扫描神器(免费社区版)
  3. 管理任务执行-有效执行
  4. mp4文件格式解析(一)
  5. 线程基础知识_线程生命周期_从JVM内存结构看多线程下的共享资源
  6. Freemarker常用技巧
  7. java string.substring 参数,Java,String类中的subString()方法,stringsubstring
  8. 之前8年都在上班工资16000,厌倦了天天上班的日子,就裸辞了。现在很迷茫,下一步怎么办?
  9. H3C 网管交换机快速配置指南(转)
  10. 企鹅F4手机外观设计有突破 配MTK6592八核处理器
  11. 高通平台msm8916修改开机logo 高通平台修改LK(bootloader)开机logo
  12. 画质增强概述-1-定义
  13. 阿里云docker安装nginx和tomcat
  14. 【毕业设计_课程设计】面向高考招生咨询的问答系统设计与实现(源码+论文)
  15. App store暂时下架应用的解决方案
  16. Kony集成百度推送-IOS
  17. pandas、pyecharts绘制基金走势图-01
  18. 妥妥的去面试之数据结构与算法(一)
  19. yolov4-tiny从安装到训练再到python调用接口
  20. CCF- CSP 202012-5星际旅行 80分骗分题解

热门文章

  1. 高中数学:求数列通项公式的十一种方法(方法全,例子全,归纳细)
  2. Mybatis缓存探索,查询集合后修改内容,再次执行sql查询结果发现是被修改过的
  3. CodeForces - 835D Palindromic characteristics (dp)
  4. SEO优化推广的特点
  5. 概率DP,递推(麻球繁殖,UVA 11021)
  6. 莫听穿林打叶声,何妨吟啸且徐行。—第十八天
  7. X710网卡RSS对称哈希
  8. python绘制动态变化的图_用Jupyter Noteb中的matplotlib绘制动态变化图形
  9. ker矩阵是什么意思_如何理解CAN通信矩阵
  10. oracle 物料属性批次过期,系列之五:ORACLE EBS 系统主数据管理(C)