
org.echocat.jomon.spring.BeanPostConfigurer Maven / Gradle / Ivy
The newest version!
/*****************************************************************************************
* *** BEGIN LICENSE BLOCK *****
*
* Version: MPL 2.0
*
* echocat Jomon, Copyright (c) 2012-2013 echocat
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* *** END LICENSE BLOCK *****
****************************************************************************************/
package org.echocat.jomon.spring;
import org.springframework.beans.BeansException;
import org.springframework.beans.FatalBeanException;
import org.springframework.beans.MutablePropertyValues;
import org.springframework.beans.PropertyValue;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.config.RuntimeBeanReference;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.core.PriorityOrdered;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.io.File;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import static java.nio.charset.Charset.forName;
import static org.echocat.jomon.spring.BeanPostConfigurer.PropertyValueType.reference;
import static org.echocat.jomon.spring.BeanPostConfigurer.PropertyValueType.value;
@SuppressWarnings("CollectionDeclaredAsConcreteClass")
public class BeanPostConfigurer implements BeanFactoryPostProcessor, PriorityOrdered {
@Nullable
private Properties _properties;
@Nonnull
private Charset _charset = forName("UTF-8");
@Nullable
private Properties _setProperties;
@Nullable
private Resource _propertiesFile;
@Nullable
private Properties _setBySystemProperties;
@Nullable
private Properties _setByResource;
public BeanPostConfigurer() throws Exception {
_properties = createNewProperties();
}
@Nonnull
protected Properties createNewProperties() throws Exception {
final Properties result = new Properties();
if (_setProperties != null) {
for (final Entry
© 2015 - 2025 Weber Informatics LLC | Privacy Policy