View Javadoc
1   /**
2    * Copyright 2010-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.common.util.config.spring.aggregation;
17  
18  import java.util.List;
19  import java.util.Properties;
20  
21  import org.kuali.common.util.spring.service.PropertySourceConfig;
22  import org.springframework.beans.factory.annotation.Autowired;
23  import org.springframework.context.annotation.Bean;
24  import org.springframework.context.annotation.Configuration;
25  import org.springframework.context.annotation.Import;
26  import org.springframework.core.env.PropertiesPropertySource;
27  import org.springframework.core.env.PropertySource;
28  
29  /**
30   * @deprecated
31   */
32  @Deprecated
33  @Configuration
34  @Import({ org.kuali.common.util.config.spring.ConfigServiceConfig.class })
35  public class ConfigPropertySourceConfig implements PropertySourceConfig {
36  
37  	private static final String PROPERTY_SOURCE_NAME = "configPropertySource";
38  
39  	@Autowired
40  	org.kuali.common.util.config.spring.ConfigServiceConfig configServiceConfig;
41  
42  	@Autowired
43  	ConfigOverridesConfig configOverridesConfig;
44  
45  	@Autowired
46  	ConfigIdsConfig configIdsConfig;
47  
48  	@Override
49  	@Bean
50  	public PropertySource<?> propertySource() {
51  		org.kuali.common.util.config.service.ConfigService service = configServiceConfig.configService();
52  		Properties overrides = configOverridesConfig.configOverrideProperties();
53  		List<String> configIds = configIdsConfig.configIds();
54  		Properties properties = service.getProperties(configIds, overrides);
55  		return new PropertiesPropertySource(PROPERTY_SOURCE_NAME, properties);
56  	}
57  
58  }