
org.kuali.common.util.spring.SpringUtils Maven / Gradle / Ivy
package org.kuali.common.util.spring;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import org.kuali.common.util.Assert;
import org.kuali.common.util.LocationUtils;
import org.kuali.common.util.LoggerLevel;
import org.kuali.common.util.LoggerUtils;
import org.kuali.common.util.PropertyUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.BeanFactoryUtils;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.GenericXmlApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.EnumerablePropertySource;
import org.springframework.core.env.Environment;
import org.springframework.core.env.MutablePropertySources;
import org.springframework.core.env.PropertiesPropertySource;
import org.springframework.core.env.PropertySource;
public class SpringUtils {
private static final Logger logger = LoggerFactory.getLogger(SpringUtils.class);
/**
* Make sure all of the locations actually exist
*/
public static void validateExists(List locations) {
StringBuilder sb = new StringBuilder();
for (String location : locations) {
if (!LocationUtils.exists(location)) {
sb.append("Location [" + location + "] does not exist\n");
}
}
if (sb.length() > 0) {
throw new IllegalArgumentException(sb.toString());
}
}
public static ConfigurableApplicationContext getContextWithPreRegisteredBeans(List beanNames, List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy