001/* 002 * Copyright 2002-2016 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.test.context; 018 019import java.util.List; 020 021/** 022 * Factory for creating {@link ContextCustomizer ContextCustomizers}. 023 * 024 * <p>Factories are invoked after {@link ContextLoader ContextLoaders} have 025 * processed context configuration attributes but before the 026 * {@link MergedContextConfiguration} is created. 027 * 028 * <p>By default, the Spring TestContext Framework will use the 029 * {@link org.springframework.core.io.support.SpringFactoriesLoader SpringFactoriesLoader} 030 * mechanism for loading factories configured in all {@code META-INF/spring.factories} 031 * files on the classpath. 032 * 033 * @author Phillip Webb 034 * @author Sam Brannen 035 * @since 4.3 036 */ 037public interface ContextCustomizerFactory { 038 039 /** 040 * Create a {@link ContextCustomizer} that should be used to customize a 041 * {@link org.springframework.context.ConfigurableApplicationContext ConfigurableApplicationContext} 042 * before it is refreshed. 043 * @param testClass the test class 044 * @param configAttributes the list of context configuration attributes for 045 * the test class, ordered <em>bottom-up</em> (i.e., as if we were traversing 046 * up the class hierarchy); never {@code null} or empty 047 * @return a {@link ContextCustomizer} or {@code null} if no customizer should 048 * be used 049 */ 050 ContextCustomizer createContextCustomizer(Class<?> testClass, List<ContextConfigurationAttributes> configAttributes); 051 052}