关于spring配置文件context:property-placeholder
首先,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"/>
错误提示:
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相关推荐
- 通过Spring配置文件中bean中的property赋值
基本数据类型赋值-通过spring配置文件中bean中的property 扩展-以此方式可以通过配置为连接数据的属性赋值 1.如果是基本数据类型,可以通过setter方法为对象中的属性设置初始值,应用 ...
- Spring配置文件applicationContext.xml中bean>>property>>name属性的含义
Spring配置文件applicationContext.xml中bean>>property>>name属性表示的含义 首先我们知道property是bean元素的子元素,它 ...
- spring中context:property-placeholder标签详解
spring中context:property-placeholder标签的使用说明 1,有些参数在某些阶段中是常量. 在开发阶段我们连接数据库时的url,username,password等信息 分 ...
- 转 spring配置文件
spring配置文件 pom文件: <properties><commons-lang.version>2.6</commons-lang.version>< ...
- spring配置文件import标签中使用${}占位符获得配置文件的属性值
2019独角兽企业重金招聘Python工程师标准>>> 一般情况下我们在Spring的配置文件中使用<import>标签是这样的,<import resource= ...
- (转)使用Spring配置文件实现事务管理
http://blog.csdn.net/yerenyuan_pku/article/details/52886207 前面我们讲解了使用Spring注解方式来管理事务,现在我们就来学习使用Sprin ...
- XML配置文件的命名空间与Spring配置文件中的头
一直以来,写Spring配置文件,都是把其他配置文件的头拷贝过来,最多改改版本号,也不清楚哪些是需要的,到底是干嘛的.今天整理一下,拒绝再无脑copy. 一.Spring配置文件常见的配置头 < ...
- spring配置文件中分别使用多个properties文件
spring配置文件中分别使用多个properties文件 在使用spring时,有时候需要为了模块配置方便有时候需要针对不同的模块建立不同的applicationContext的配置文件,然后在对应 ...
- JAVA spring配置文件总结
首先来看一个标准的Spring配置文件 applicationContext.xml <?xml version="1.0" encoding="UTF-8&quo ...
最新文章
- 2021-05-09
- 页面打印错误 抛出异常 公司内部用
- 我来悟微服务(3)-需求管理
- python下载的文件放在哪里的-Python下载文件的方法
- boost::math::barycentric_rational用法的测试程序
- java多线程 -- ReadWriteLock 读写锁
- 采用开源方案的优势--从搭建WebGIS系统说起
- 转 alsa录音放音执行流程详解
- LeetCode 314. 二叉树的垂直遍历(BFS/DFS)
- Spring框架如何加载和定义Spring Bean类?
- 对pca降维后的手写体数字图片数据分类_知识干货-机器学习-TSNE数据降维
- 萌宠主题页面设计灵感
- Android中如何解决输入法键盘和activity页面遮挡的问题
- 计算机毕业设计基于asp.net企业差旅管理系统
- 代码:细化法+灰度重心法提取线激光条纹中心线(CPP+OpenCV)
- hugo搭建个人博客
- c语言求5个整数最小公倍数,C语言求两个正整数的最小公倍数和最大公约数
- mysql免安装部署_MySQL免安装版配置部署
- Referenced file contains errors (xml文件第一行小红叉错误)
- PhotoShop如何使用图层之实例演示?