今天在配置多配置文件的时候偶然发现如果我使用

  <context:property-placeholder location="classpath:filePath.properties"/> 
这个进行多行编写配置文件的时候会出现后面那个文件出现读取不到的问题
     <context:property-placeholder location="classpath:jdbc.properties"/>
<context:property-placeholder location="classpath:filePath.properties"/>

这样会导致后面那个配置文件失效

原因:Spring 只会加载第一个context:property-placeholder配置后面的文件将不会再次进行加载,所以导致后面的文件读取不到

解决办法:

    <context:property-placeholder ignore-unresolvable="true" location="classpath:jdbc.properties,classpath:filePath.properties"/>

加入一个ignore-unresolvable="true"属性,将文件用,隔开就可以了

  

Spring context:property-placeholder 一些坑的更多相关文章

  1. spring整合mybatis使用<context:property-placeholder>时的坑

    背景 最近项目要上线,需要开发一个数据迁移程序.程序的主要功能就是将一个数据库里的数据,查询出来经过一系列处理后导入另一个数据库.考虑到开发的方便快捷.自然想到用spring和mybatis整合一下. ...

  2. Spring context的refresh函数执行过程分析

    今天看了一下Spring Boot的run函数运行过程,发现它调用了Context中的refresh函数.所以先分析一下Spring context的refresh过程,然后再分析Spring boo ...

  3. (转)面试必备技能:JDK动态代理给Spring事务埋下的坑!

    一.场景分析 最近做项目遇到了一个很奇怪的问题,大致的业务场景是这样的:我们首先设定两个事务,事务parent和事务child,在Controller里边同时调用这两个方法,示例代码如下: 1.场景A ...

  4. 部署spring boot + Vue遇到的坑(权限、刷新404、跨域、内存)

    部署spring boot + Vue遇到的坑(权限.刷新404.跨域.内存) 项目背景是采用前后端分离,前端使用vue,后端使用springboot. 工具 工欲善其事必先利其器,我们先找一个操作L ...

  5. [转载]vs2012中使用Spring.NET报错:Spring.Context.Support.ContextRegistry 的类型初始值设定项引发异常

    学习使用Spring.NET中的时候,写了一个Demo,在运行时报了一个错误:Spring.Context.Support.ContextRegistry 的类型初始值设定项引发异常. 重新整理思绪, ...

  6. Spring context:component-scan中使用context:include-filter和context:exclude-filter

    Spring context:component-scan中使用context:include-filter和context:exclude-filter XML: <?xml version= ...

  7. Spring context:component-scan代替context:annotation-config

    Spring context:component-scan代替context:annotation-config XML: <?xml version="1.0" encod ...

  8. JDK动态代理给Spring事务埋下的坑!

    一.场景分析 最近做项目遇到了一个很奇怪的问题,大致的业务场景是这样的:我们首先设定两个事务,事务parent和事务child,在Controller里边同时调用这两个方法,示例代码如下: 1.场景A ...

  9. Spring <context:component-scan>标签属性 use-default-filters 以及子标签 include-filter使用说明

    Spring <context:component-scan>标签作用有很多,最基本就是 开启包扫描,可以使用@Component.@Service.@Component等注解: 今天要作 ...

  10. 使用web.xml方式加载Spring时,获取Spring context的两种方式

    使用web.xml方式加载Spring时,获取Spring context的两种方式: 1.servlet方式加载时: [web.xml] <servlet> <servlet-na ...

随机推荐

  1. WinForm中,设置不显示窗口的标题栏

    1:ControlBox设置False,然后标题为""的时候标题就不显示了2:把窗体设置为无边的窗体 FormBoderStyle 设为 None  (在Mdi中,关闭按钮会还在) ...

  2. border样式?

    border样式? 设置边框样式: border:宽度 外形 颜色:(自动设置顺序:top,right,bottom,left) boeder-top:宽度 外形 颜色:(单独为某一个边边框设置样式) ...

  3. BFC(块级格式上下文)

    BFC的生成 满足下列css声明之一的元素便会生成BFC 根元素 float的值不为none overflow的值不为visible display的值为inline-block.table-cell ...

  4. Struts2 (二)

    1 自定义结果视图 1.1 自定义一个类实现com.opensymphony.xwork2.Result接口. package com.xuweiwei.action; import com.open ...

  5. 04_Javascript初步第三天

    事件 内联模型.脚本模型,DOM2级模型 <!--内联模型--> <input type="button" value="bt1" oncli ...

  6. all,any函数

    all函数:当矩阵全为非零元素时返回1,否则(存在零元素),返回0: any函数:当矩阵中存在非零      1     1     1     1      1     1     1     1 ...

  7. java.lang.String中[ "张飞"+1+1 ] 和 [ "张飞"+(1+1) ]

    废话不多说,上代码: package com.core; public class StringTest { public static void main(String[] args) { Stri ...

  8. 命令行登陆mysql提示'mysql' 不是内部或外部命令

    问题:命令行登陆mysql提示'mysql' 不是内部或外部命令.如图1所示. 图1 原因:没有将mysql的bin文件夹配置到环境变量里区,因为命令行登陆mysql需要调用bin下的mysql.ex ...

  9. 使用jdbc存储图片和大文本

    package cn.itcast.i_batch; import java.sql.Connection; import java.sql.PreparedStatement; import jav ...

  10. Python 定位桌面

    通过注册表寻找桌面路径: (用内置的winreg) import winreg key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, \             ...