@@ -0,0 +1,3632 @@
+/**%0A * Licensed to Apereo under one or more contributor license%0A * agreements. See the NOTICE file distributed with this work%0A * for additional information regarding copyright ownership.%0A * Apereo licenses this file to you under the Apache License,%0A * Version 2.0 (the %22License%22); you may not use this file%0A * except in compliance with the License.  You may obtain a%0A * copy of the License at the following location:%0A *%0A *   http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing,%0A * software distributed under the License is distributed on an%0A * %22AS IS%22 BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY%0A * KIND, either express or implied.  See the License for the%0A * specific language governing permissions and limitations%0A * under the License.%0A */%0Apackage org.springframework.context.support;%0A%0Aimport java.io.IOException;%0A%0Aimport org.springframework.beans.BeansException;%0Aimport org.springframework.beans.factory.BeanInitializationException;%0Aimport org.springframework.beans.factory.config.ConfigurableListableBeanFactory;%0Aimport org.springframework.core.env.MutablePropertySources;%0Aimport org.springframework.core.env.PropertiesPropertySource;%0Aimport org.springframework.core.env.PropertyResolver;%0Aimport org.springframework.core.env.PropertySource;%0Aimport org.springframework.core.env.PropertySourcesPropertyResolver;%0A%0A%0A/**%0A * @author Josh Helmer, jhelmer@unicon.net%0A */%0Apublic class ExtendedPropertySourcesPlaceholderConfigurer extends PropertySourcesPlaceholderConfigurer %7B%0A    public static final String EXTENDED_PROPERTIES_SOURCE = %22extendedPropertiesSource%22;%0A%0A    private PropertyResolver propertyResolver;%0A%0A%0A    /**%0A     * Override the postProcessing.  The default PropertySourcesPlaceholderConfigurer does not inject%0A     * local properties into the Environment object.  It builds a local list of properties files and%0A     * then uses a transient Resolver to resolve the @Value annotations.   That means that you are%0A     * unable to get to %22local%22 properties (eg. portal.properties) after bean post-processing has%0A     * completed unless you are going to re-parse those file.  This is similar to what%0A     * PropertiesManager does, but it uses all the property files configured, not just portal.properties.%0A     *%0A     * If we upgrade to spring 4, there are better/more efficient solutions available.  I'm not aware%0A     * of better solutions for spring 3.x.%0A     *%0A     * @param beanFactory the bean factory%0A     * @throws BeansException if an error occurs while loading properties or wiring up beans%0A     */%0A    @Override%0A    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException %7B%0A        if (propertyResolver == null) %7B%0A            try %7B%0A                MutablePropertySources sources = new MutablePropertySources();%0A                PropertySource%3C?%3E localPropertySource = new PropertiesPropertySource(EXTENDED_PROPERTIES_SOURCE, mergeProperties());%0A                sources.addLast(localPropertySource);%0A%0A                propertyResolver = new PropertySourcesPropertyResolver(sources);%0A%0A            %7D catch (IOException e) %7B%0A                throw new BeanInitializationException(%22Could not load properties%22, e);%0A            %7D%0A        %7D%0A%0A        super.postProcessBeanFactory(beanFactory);%0A    %7D%0A%0A%0A    /**%0A     * Get a property resolver that can read local properties.%0A     *%0A     * @return a property resolver that can be used to dynamically read the merged property%0A     * values configured in applicationContext.xml%0A     */%0A    public PropertyResolver getPropertyResolver() %7B%0A        return propertyResolver;%0A    %7D%0A%7D%0A

Add ExtendedPropertySourcesPlaceholderConfigurer to be used if needed