<bean id="placeholderConfig" class="com.shz.utils.AdvancedPlaceholderConfigurer">
        <property name="locations">
            <list>
                <value>classpath:init.properties</value>
                <value>classpath:api.properties</value>                
            </list>
        </property>
    </bean>
    
     <bean id="systemProperties" class="java.util.HashMap" />

public class AdvancedPlaceholderConfigurer extends PropertyPlaceholderConfigurer{

@SuppressWarnings({ "unchecked", "rawtypes" })
    @Override
    protected void processProperties(
            ConfigurableListableBeanFactory beanFactoryToProcess,
            Properties props) throws BeansException {
        
        super.processProperties(beanFactoryToProcess, props);
        
        /******** Set the properties to initProperties object ********/
        HashMap<String, String> systemProperties = (HashMap<String, String>)beanFactoryToProcess.getBean("systemProperties");
        logger.info("starting to load configs into systemProperties object ...");
        Enumeration e = props.propertyNames();
        while (e.hasMoreElements()) {
            String key = (String) e.nextElement();
            systemProperties.put(key,  props.getProperty(key));
        }
        logger.info("finished to load configs into systemProperties object");
    }
    
}

public String openAgent(AgentInfoParams forexAgentInfoParams) {
        init();
        try {
            ApplicationContext context = MyContextLoaderListener.getApplicationContext();
            Map<String, String> systemProperties = (Map<String, String>) context.getBean("systemProperties");
            String to = systemProperties.get("constantNZ.forex_cs_agent");
        } catch (Exception e) {
            logger.error("error", e);
            return "ERROR:" + e.getMessage();
        }

return "OK";
    }

web应用中对配置文件的包装的更多相关文章

  1. J2EE进阶(五)Spring在web.xml中的配置

     J2EE进阶(五)Spring在web.xml中的配置 前言 在实际项目中spring的配置文件applicationcontext.xml是通过spring提供的加载机制自动加载到容器中.在web ...

  2. Spring web.xml中的配置

    转载博客:http://blog.163.com/zhangke_616/blog/static/191980492007994948206/ 在实际项目中spring的配置文件application ...

  3. Web环境中Spring的启动过程

    1.spring不但可以在JavaSE环境中应用,在Web环境中也可以广泛应用,Spring在web环境中应用时,需要在应用的web.xml文件中添加如下的配置: …… <context-par ...

  4. spring在web.xml中的配置

    在实际项目中spring的配置文件applicationcontext.xml是通过spring提供的加载机制,自动加载的容器中去,在web项目中,配置文件加载到web容器中进行解析,目前,sprin ...

  5. Web 项目 中读取专用配置文件

    在 web 开发中,有时我们要为 业务逻辑处理 配置专用的 配置文件,也就是 xml 文件,这样可以极大的方便维护工作,但是读取 专用的配置文件还需要自己写一个方法,在这里,我封装了一个公用 的方法: ...

  6. Spring中,applicationContext.xml 配置文件在web.xml中的配置详解

    一.首先写一下代码结构. 二.再看web.xml中的配置情况. <?xml version="1.0" encoding="UTF-8"?> < ...

  7. web项目中配置文件的加载顺序

    当一个项目启动时,首先是web.xml: 这里面的配置: 为什么要在web.xml中配置struts的过滤器? 因为一个web项目运行的时需要加载的,或者默认的部分配置都会在web.xml中配置,中间 ...

  8. Web.xml中自动扫描Spring的配置文件及resource时classpath*:与classpath:的区别

    Web.xml中自动扫描Spring的配置文件及resource时classpath*:与classpath:的区别 一.Web.xml中自动扫描Spring的配置文件(applicationCont ...

  9. spring的配置文件在web.xml中加载的方式

    web.xml加载spring配置文件的方式主要依据该配置文件的名称和存放的位置不同来区别,目前主要有两种方式. 1.如果spring配置文件的名称为applicationContext.xml,并且 ...

随机推荐

  1. Selenium定位一 --单个元素定位方法

    Selenium-Webdriver 提供了强大的元素定位方法,支持以下三种方法. 单个对象的定位方法 多个对象的定位方法 层级定位 定位单个元素在定位单个元素时,selenium-webdriver ...

  2. javascript confirm()函数的用法

    javascript confirm()函数的用法 confirm():确认消息对话框.用于允许用户做选择的动作.弹出的对话框中包含一确定按钮和一取消按钮. confirm(str) 参数说明: st ...

  3. cocoapod的下载安装解释

    本文不提供cocoapod的下载安装的流程,因为那些只要百度一下就有的东西,而是对里面的代码进行解释,希望对iOS小白安装cocoapod有帮助: 一.cocoapod是什么? 开发过程中,我们会用到 ...

  4. [原创]cocos2d-x研习录-第二阶 概念类之导演类(CCDirector)

    CCDirector类是游戏的组织和控制中心(总指挥),它控制着主屏幕的显示.场景的切换和显示,以及游戏的开始.结束和暂停.它的继承关系图如下:    CCDirector继承自基类CCObject, ...

  5. java 生成8位数字作为UID

    java 生成8位数字作为UUID: /*** * 生成uid 8位数字 */public static String generateUID(){ Random random = new Rando ...

  6. css固定姓名显示长度,排列更整齐

    white-space: nowrap 不换形 overflow: hidden 隐藏长度超出部分 text-overflow:ellipsis  文字长度超出用省略号代替 <p style=& ...

  7. Java条形码生成技术-Barcode4j

    背景 目前二维码的应用场景已经遍布各类互联网平台,通常是将产品/商品的唯一编号存储于二维码中以做扫码识别. 而用于生产环境的条形码技术仍然存在,如硬件设备制造.供应.物流运输等等. 在常见的产品信息管 ...

  8. maxscript, 批量导出物体

    1,将场景中所有选中物体整体导出为一个fbx文件 exportfile filename #noprompt selectedOnly:true using:FBXEXP 2,将场景中所有选中物体各导 ...

  9. Unity Shader——Writing Surface Shaders(2)——Custom Lighting models in Surface Shaders

    Surface Shader中的自定义光照模型 当你在编写 Surface Shaders 时,是在描述一个表面的属性(反射颜色.法线……),而且光的交互过程是由一个光照模型来计算的.内建的光照模型有 ...

  10. 解决php的“It is not safe to rely on the system’s timezone settings”问题

    PHP调试的时候出现了警告: It is not safe to rely on the system解决方法,其实就是时区设置不正确造成的,本文提供了3种方法来解决这个问题. 实 际上,从PHP 5 ...