package com.wechat.config;

import javax.annotation.PostConstruct;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class ConfigReader {
	
	private static final Log logger = LogFactory
			.getLog(ConfigReader.class);
	
	@PostConstruct
	private void PrintLog() {
		logger.info("Configuration Initializing...");
		logger.info(String.format("%s is %s", "redisUrl", redisUrl));
		logger.info(String.format("%s is %s", "jdbcUrl", jdbcUrl));
		logger.info(String.format("%s is %s", "apiURL", apiURL));
	}
	
	//just for log,no setter,getter
	@Value("#{configProperties['redis.ip']}")
	private String redisUrl;
	
	//just for log,no setter,getter
	@Value("#{configProperties['jdbc.oracle.url']}")
	private String jdbcUrl;
	
	
	
	@Value("#{configProperties['middleAPIURL']}")
	private String apiURL;
	
	@Value("#{configProperties['token.key']}")
	private String tokenKey;
	
	public String getApiURL() {
		return apiURL;
	}

	public void setApiURL(String apiURL) {
		this.apiURL = apiURL;
	}

	public String getTokenKey() {
		return tokenKey;
	}

	public void setTokenKey(String tokenKey) {
		this.tokenKey = tokenKey;
	}

}
