001 /**
002 * Copyright 2010-2013 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.kuali.common.deploy.spring;
017
018 import java.util.Arrays;
019 import java.util.List;
020
021 import org.kuali.common.deploy.DeployProjectContext;
022 import org.kuali.common.jdbc.JdbcProjectContext;
023 import org.kuali.common.util.Mode;
024 import org.kuali.common.util.ProjectContext;
025 import org.kuali.common.util.property.ProjectProperties;
026 import org.kuali.common.util.spring.ConfigUtils;
027 import org.kuali.common.util.spring.MavenPropertySourceConfig;
028 import org.springframework.context.annotation.Configuration;
029
030 /**
031 * This lets properties defined in the pom override properties defined elsewhere. System/environment properties still override everything.
032 */
033 @Configuration
034 public class DeployMavenPropertySourceConfig extends MavenPropertySourceConfig {
035
036 @Override
037 protected List<ProjectProperties> getOtherProjectProperties() {
038 ProjectContext jdbc = new JdbcProjectContext();
039 ProjectProperties jpp = ConfigUtils.getProjectProperties(jdbc);
040 ProjectProperties dpp = getDeployProjectProperties();
041 return Arrays.asList(jpp, dpp);
042 }
043
044 public ProjectProperties getDeployProjectProperties() {
045 ProjectContext deploy = new DeployProjectContext();
046 ProjectProperties dpp = ConfigUtils.getProjectProperties(deploy);
047 // Some environments don't have any special properties and thus no corresponding properties file
048 dpp.getPropertiesContext().setMissingLocationsMode(Mode.INFORM);
049 return dpp;
050 }
051
052 }