1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.sys.context;
17
18 import java.io.IOException;
19 import java.util.Properties;
20
21 import org.kuali.rice.core.api.config.property.Config;
22 import org.kuali.rice.core.api.config.property.ConfigContext;
23 import org.kuali.rice.core.impl.config.property.ConfigLogger;
24 import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
25
26
27
28
29
30
31 public class ConfigPropertyPlaceholderConfigurer extends PropertyPlaceholderConfigurer {
32 protected static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(ConfigPropertyPlaceholderConfigurer.class);
33
34 public ConfigPropertyPlaceholderConfigurer() {
35 setSystemPropertiesMode(PropertyPlaceholderConfigurer.SYSTEM_PROPERTIES_MODE_OVERRIDE);
36 }
37
38 @Override
39 protected void loadProperties(Properties props) throws IOException {
40
41 super.loadProperties(props);
42
43 ConfigContext.getCurrentContextConfig().putProperties(props);
44
45 if ( LOG.isDebugEnabled() ) {
46 Config config = ConfigContext.getCurrentContextConfig();
47 if (config != null) {
48 LOG.debug("Replacing parameters in Spring using config:\r\n" + config);
49 ConfigLogger.logConfig(config);
50 }
51 }
52 }
53 }