001/*
002 * Copyright 2002-2012 the original author or authors.
003 *
004 * Licensed under the Apache 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 *      https://www.apache.org/licenses/LICENSE-2.0
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
017package org.springframework.web.context;
018
019import javax.servlet.ServletConfig;
020import javax.servlet.ServletContext;
021
022import org.springframework.core.env.ConfigurableEnvironment;
023import org.springframework.lang.Nullable;
024
025/**
026 * Specialization of {@link ConfigurableEnvironment} allowing initialization of
027 * servlet-related {@link org.springframework.core.env.PropertySource} objects at the
028 * earliest moment that the {@link ServletContext} and (optionally) {@link ServletConfig}
029 * become available.
030 *
031 * @author Chris Beams
032 * @since 3.1.2
033 * @see ConfigurableWebApplicationContext#getEnvironment()
034 */
035public interface ConfigurableWebEnvironment extends ConfigurableEnvironment {
036
037        /**
038         * Replace any {@linkplain
039         * org.springframework.core.env.PropertySource.StubPropertySource stub property source}
040         * instances acting as placeholders with real servlet context/config property sources
041         * using the given parameters.
042         * @param servletContext the {@link ServletContext} (may not be {@code null})
043         * @param servletConfig the {@link ServletConfig} ({@code null} if not available)
044         * @see org.springframework.web.context.support.WebApplicationContextUtils#initServletPropertySources(
045         * org.springframework.core.env.MutablePropertySources, ServletContext, ServletConfig)
046         */
047        void initPropertySources(@Nullable ServletContext servletContext, @Nullable ServletConfig servletConfig);
048
049}