01: /*
02: * Copyright 2007 The Kuali Foundation
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
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.rice.config.spring;
17:
18: import org.kuali.rice.config.Config;
19: import org.kuali.rice.config.ConfigLogger;
20: import org.kuali.rice.core.Core;
21: import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
22:
23: /**
24: * Configures a property placeholder in Spring which will allow access to the properties configured in
25: * the workflow configuration.
26: *
27: * @author Kuali Rice Team (kuali-rice@googlegroups.com)
28: */
29: public class ConfigPropertyPlaceholderConfigurer extends
30: PropertyPlaceholderConfigurer {
31: protected final org.apache.log4j.Logger log = org.apache.log4j.Logger
32: .getLogger(getClass());
33:
34: public ConfigPropertyPlaceholderConfigurer() {
35: setProperties();
36: }
37:
38: private void setProperties() {
39: setSystemPropertiesMode(PropertyPlaceholderConfigurer.SYSTEM_PROPERTIES_MODE_OVERRIDE);
40: Config config = Core.getCurrentContextConfig();
41: if (config != null) {
42: log
43: .debug("Replacing parameters in Spring using config:\r\n"
44: + config);
45: ConfigLogger.logConfig(config);
46: setProperties(config.getProperties());
47: }
48: }
49: }
|