12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- package com.kmall.admin.config;
- import com.kmall.admin.properties.EccsProperties;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.beans.factory.annotation.Configurable;
- import org.springframework.beans.factory.annotation.Value;
- import org.springframework.context.annotation.Bean;
- import org.springframework.context.annotation.Configuration;
- import org.springframework.context.annotation.PropertySource;
- import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
- import org.springframework.core.env.Environment;
- import org.springframework.core.env.StandardEnvironment;
- /**
- * @author zhangchuangbiao
- * @version 1.0
- * 2021-01-28 15:27
- */
- @Configuration
- @PropertySource("classpath:conf/eccs.properties")
- public class EccsPropertiesConfig {
- // @Value("${md5Salt}")
- private String md5Salt;
- // @Value("${requestUrl}")
- private String requestUrl;
- @Autowired
- private Environment environment;
- @Bean
- public EccsProperties ecsProperties(){
- String md5Salt = environment.getProperty("md5Salt");
- String requestUrl = environment.getProperty("requestUrl");
- EccsProperties eccsProperties = new EccsProperties();
- eccsProperties.setMd5Salt(md5Salt);
- eccsProperties.setRequestUrl(requestUrl);
- return eccsProperties;
- }
- }
|