首先,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. 2021-05-09
  2. 页面打印错误 抛出异常 公司内部用
  3. 我来悟微服务(3)-需求管理
  4. python下载的文件放在哪里的-Python下载文件的方法
  5. boost::math::barycentric_rational用法的测试程序
  6. java多线程 -- ReadWriteLock 读写锁
  7. 采用开源方案的优势--从搭建WebGIS系统说起
  8. 转 alsa录音放音执行流程详解
  9. LeetCode 314. 二叉树的垂直遍历(BFS/DFS)
  10. Spring框架如何加载和定义Spring Bean类?
  11. 对pca降维后的手写体数字图片数据分类_知识干货-机器学习-TSNE数据降维
  12. 萌宠主题页面设计灵感
  13. Android中如何解决输入法键盘和activity页面遮挡的问题
  14. 计算机毕业设计基于asp.net企业差旅管理系统
  15. 代码:细化法+灰度重心法提取线激光条纹中心线(CPP+OpenCV)
  16. hugo搭建个人博客
  17. c语言求5个整数最小公倍数,C语言求两个正整数的最小公倍数和最大公约数
  18. mysql免安装部署_MySQL免安装版配置部署
  19. Referenced file contains errors (xml文件第一行小红叉错误)
  20. PhotoShop如何使用图层之实例演示?

热门文章

  1. linux wifi设置和相关介绍
  2. Windows 2003 server 搭建拨号服务器
  3. 自媒体搞笑领域怎么做?这几个类型都很热门,可以尝试
  4. 刚刚随便GOOGLE和BAIDU了下PIPO和BLOG
  5. Ritzy Aspen酒店联手Indiegogo使用区块链出售房产
  6. Antd pro中ProFormSelect使用initialValues
  7. 如何利用开盘半小时预测当天走势
  8. TP-LINK 150M无线宽带路由器TL-WR740N 路由器当无线AP(交换机用)
  9. 利用facebook graph api发送图片
  10. 一摞烙饼的排序(搜索树)