码迷,mamicode.com
首页 > 其他好文 > 详细

PropertyPlaceholderConfigurer

时间:2016-12-22 15:18:04      阅读:270      评论:0      收藏:0      [点我收藏+]

标签:propertyplaceholderconfigurer

package com.itrus.define;


import java.util.HashMap;

import java.util.Map;

import java.util.Properties;

import org.springframework.beans.BeansException;

import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;

import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;

public class ProDefineConfigurer extends PropertyPlaceholderConfigurer {

private static Map<String, Object> ctxPropertiesMap;

@Override  

   protected void processProperties(ConfigurableListableBeanFactory beanFactory,  

           Properties props)throws BeansException {  

       super.processProperties(beanFactory, props);  

       ctxPropertiesMap = new HashMap<String, Object>();  

       for (Object key : props.keySet()) {  

           String keyStr = key.toString();  

           String value = props.getProperty(keyStr);  

           ctxPropertiesMap.put(keyStr, value);  

       }

   }

   public static Object getContextProperty(String name) {  

       return ctxPropertiesMap.get(name);  

   } 

}




notifyEmail=yes

notifySms=no

personApproval=no




PropertyPlaceholderConfigurer

标签:propertyplaceholderconfigurer

原文地址:http://yjm199.blog.51cto.com/4408395/1885018

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!