在stackoverflow上看到一个问题
配置如下:
<context:property-placeholder location="/WEB-INF/application-customer-dev.properties,classpath:application-customer.properties" ignore-resource-not-found="true"/>

<import resource="classpath*:com/x/core/security/security-${login.security}.xml"/>
在application-customer.properties中有配置项:
login.security=dev
可是import却没能按照期望的发生。
解释如下:
大概spring context解析过程如下:

Basically Spring XML context setup goes more or less like this:

1、Context is created.

2、Environment is set.

3、XML is read (all XML, resolving imports if necessary). Bean definitions are created.

4、BeanFactoryPostProcessors are installed and invoked, processing bean definitions.

5、BeanPostProcessors are installed.

6、Beans are instantiated according to the bean definitions. BeanPostProcessors are applied.

 

PropertySourcesPlaceholderConfigurer 是一个BeanFactoryPostProcessor,这样的话,import必然发生在BeanPostProcessors 之前,也就无法解析。这是spring硬编码的,你无法改变。

spring properties resolve 问题的更多相关文章

  1. Spring properties dependency checking

    In Spring,you can use dependency checking feature to make sure the required properties have been set ...

  2. [Spring] Properties for project configuration

    We might have some project specific configuration need to setup. The good approach to do this in Spr ...

  3. 【Spring源码分析】.properties文件读取及占位符${...}替换源码解析

    前言 我们在开发中常遇到一种场景,Bean里面有一些参数是比较固定的,这种时候通常会采用配置的方式,将这些参数配置在.properties文件中,然后在Bean实例化的时候通过Spring将这些.pr ...

  4. Spring boot 配置文件详解 (properties 和yml )

    从其他框架来看 我们都有自己的配置文件, hibernate有hbm,mybatis 有properties, 同样, Spring boot 也有全局配置文件. Springboot使用一个全局的配 ...

  5. eclips环境下开发spring boot项目,application.properties配置文件下中文乱码解决方案

    如以上,application.properties文件下中文乱码.发生乱码一般都是由于编码格式不一样导致的. 打开Window-Preferences-General-content Types-T ...

  6. spring boot项目,application.properties配置文件下中文乱码解决方案

    转自:https://blog.csdn.net/qq_40408534/article/details/79831807 如以上,application.properties文件下中文乱码.发生乱码 ...

  7. Java-马士兵设计模式学习笔记-工厂模式-模拟Spring读取Properties文件

    一.目标:读取properties文件,获得类名来生成对象 二.类 1.Movable.java public interface Movable { void run(); } 2.Car.java ...

  8. Spring 中无处不在的 Properties

    转自:https://javadoop.com/post/spring-properties?hmsr=toutiao.io&utm_medium=toutiao.io&utm_sou ...

  9. 译:Spring框架参考文档之IoC容器(未完成)

    6. IoC容器 6.1 Spring IoC容器和bean介绍 这一章节介绍了Spring框架的控制反转(IoC)实现的原理.IoC也被称作依赖注入(DI).It is a process wher ...

随机推荐

  1. C++获取进程号及窗口

    #include <TlHelp32.h> //根据进程名获取进程ID BOOL GetPidByProcessName(TCHAR *pProcess, DWORD*dwPid) { H ...

  2. 配置域名服务器报错named[822]: dns_rdata_fromtext /etc/bind/db.asertest.com mail not a valid number

    问题描述: 为了配置邮件服务器,更改了相关域名,改完后,重启bind9报错 Mar 17 14:39:39 DnsServer2 named[822]: dns_rdata_fromtext: /et ...

  3. window下python 扩展库安装 使用第三方镜像源

    0.前言     由于python的官方镜像位于国外,若使用pip或者easy_install安装第三方插件时或许会被限制,甚至连easy_install或pip也无法安装,例如在windows环境下 ...

  4. UIPikerView

    UIPikerView的属性 1.   numberOfComponents:返回UIPickerView当前的列数 NSInteger num = _pickerView.numberOfCompo ...

  5. hadoop NameNode 实现分析

    在hadoop 整体分析中,说过nameNode主要是实现一个 blockID 到对应 dataNode的对应关系映射. 现在分析一下腰实现这个映射,nameNode还需要哪些模块. 1 为了方便用户 ...

  6. github每次推送都要输入用户名和密码

    /***************************************************************************** * github每次推送都要输入用户名和密 ...

  7. UVA 11374 Halum (差分约束系统,最短路)

    题意:给定一个带权有向图,每次你可以选择一个结点v 和整数d ,把所有以v为终点的边权值减少d,把所有以v为起点的边权值增加d,最后要让所有的边权值为正,且尽量大.若无解,输出结果.若可无限大,输出结 ...

  8. (五)用正则化(Regularization)来解决过拟合

    1 过拟合 过拟合就是训练模型的过程中,模型过度拟合训练数据,而不能很好的泛化到测试数据集上.出现over-fitting的原因是多方面的: 1) 训练数据过少,数据量与数据噪声是成反比的,少量数据导 ...

  9. Android Studio 学习 - HelloWorld

    今天是学习Android Studio的第2天,加油! 1. 首先要记录下使用Android Studio的一个代码自动完成的功能.平常基本上用Delphi,乍一换工具,各种不习惯,或者说不熟悉.按照 ...

  10. Clusterware后台进程

    Clusterware由若干进程组成,其中最重要的是CRSD,CSSD,EVMD   在Clusterware安装的最后阶段,会要求在每个节点执行root.sh脚本,这个脚本实际的作用就是在/etc/ ...