All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.wicp.tams.commons.spring.SpringConfiguration Maven / Gradle / Ivy

There is a newer version: 2.3.4
Show newest version
package net.wicp.tams.commons.spring;

import java.util.Properties;

import org.springframework.context.EnvironmentAware;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;

import net.wicp.tams.commons.Conf;
import net.wicp.tams.commons.Conf.InitCallback;

/***
 * spring cloud需要用到的配置信息加载
 * 
 * @author zhoujunhui
 *
 */
@Configuration
public class SpringConfiguration {
	@Configuration
	protected static class MidConfiguration implements EnvironmentAware {

		@Override
		public void setEnvironment(Environment environment) {
			final Properties inputpamas = new Properties();
			Properties zaProps = Conf.copyProperties();
			for (Object key : zaProps.keySet()) {
				String keystr = String.valueOf(key);
				if (environment.containsProperty(keystr)) {
					inputpamas.put(keystr, environment.getProperty(keystr));
				}
			}
			Conf.addCallBackInit("conf-microservices", new InitCallback() {
				@Override
				public Properties doInitConf() {
					return inputpamas;
				}
			});
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy