|
Spring Framework example source code file (AbstractRefreshableConfigApplicationContext.java)
The Spring Framework AbstractRefreshableConfigApplicationContext.java source code/* * Copyright 2002-2008 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.context.support; import org.springframework.beans.factory.BeanNameAware; import org.springframework.beans.factory.InitializingBean; import org.springframework.context.ApplicationContext; import org.springframework.util.Assert; import org.springframework.util.StringUtils; import org.springframework.util.SystemPropertyUtils; /** * {@link AbstractRefreshableApplicationContext} subclass that adds common handling * of specified config locations. Serves as base class for XML-based application * context implementations such as {@link ClassPathXmlApplicationContext} and * {@link FileSystemXmlApplicationContext}, as well as * {@link org.springframework.web.context.support.XmlWebApplicationContext} and * {@link org.springframework.web.portlet.context.XmlPortletApplicationContext}. * * @author Juergen Hoeller * @since 2.5.2 * @see #setConfigLocation * @see #setConfigLocations * @see #getDefaultConfigLocations */ public abstract class AbstractRefreshableConfigApplicationContext extends AbstractRefreshableApplicationContext implements BeanNameAware, InitializingBean { private String[] configLocations; private boolean setIdCalled = false; /** * Create a new AbstractRefreshableConfigApplicationContext with no parent. */ public AbstractRefreshableConfigApplicationContext() { } /** * Create a new AbstractRefreshableConfigApplicationContext with the given parent context. * @param parent the parent context */ public AbstractRefreshableConfigApplicationContext(ApplicationContext parent) { super(parent); } /** * Set the config locations for this application context in init-param style, * i.e. with distinct locations separated by commas, semicolons or whitespace. * <p>If not set, the implementation may use a default as appropriate. */ public void setConfigLocation(String location) { setConfigLocations(StringUtils.tokenizeToStringArray(location, CONFIG_LOCATION_DELIMITERS)); } /** * Set the config locations for this application context. * <p>If not set, the implementation may use a default as appropriate. */ public void setConfigLocations(String[] locations) { if (locations != null) { Assert.noNullElements(locations, "Config locations must not be null"); this.configLocations = new String[locations.length]; for (int i = 0; i < locations.length; i++) { this.configLocations[i] = resolvePath(locations[i]).trim(); } } else { this.configLocations = null; } } /** * Return an array of resource locations, referring to the XML bean definition * files that this context should be built with. Can also include location * patterns, which will get resolved via a ResourcePatternResolver. * <p>The default implementation returns Other Spring Framework examples (source code examples)Here is a short list of links related to this Spring Framework AbstractRefreshableConfigApplicationContext.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.