|
| 1 | +/* |
| 2 | + * Copyright 2012-present the original author or authors. |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * https://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +package org.springframework.boot.env; |
| 18 | + |
| 19 | +import org.springframework.boot.bootstrap.BootstrapContext; |
| 20 | +import org.springframework.boot.bootstrap.BootstrapRegistry; |
| 21 | +import org.springframework.boot.bootstrap.ConfigurableBootstrapContext; |
| 22 | +import org.springframework.boot.logging.DeferredLogFactory; |
| 23 | +import org.springframework.core.env.ConfigurableEnvironment; |
| 24 | +import org.springframework.core.env.Environment; |
| 25 | + |
| 26 | +/** |
| 27 | + * Allows for customization of the application's {@link Environment} prior to the |
| 28 | + * application context being refreshed. |
| 29 | + * <p> |
| 30 | + * EnvironmentPostProcessor implementations have to be registered in |
| 31 | + * {@code META-INF/spring.factories}, using the fully qualified name of this class as the |
| 32 | + * key. Implementations may implement the {@link org.springframework.core.Ordered Ordered} |
| 33 | + * interface or use an {@link org.springframework.core.annotation.Order @Order} annotation |
| 34 | + * if they wish to be invoked in specific order. |
| 35 | + * <p> |
| 36 | + * Since Spring Boot 2.4, {@code EnvironmentPostProcessor} implementations may optionally |
| 37 | + * take the following constructor parameters: |
| 38 | + * <ul> |
| 39 | + * <li>{@link DeferredLogFactory} - A factory that can be used to create loggers with |
| 40 | + * output deferred until the application has been fully prepared (allowing the environment |
| 41 | + * itself to configure logging levels).</li> |
| 42 | + * <li>{@link ConfigurableBootstrapContext} - A bootstrap context that can be used to |
| 43 | + * store objects that may be expensive to create, or need to be shared |
| 44 | + * ({@link BootstrapContext} or {@link BootstrapRegistry} may also be used).</li> |
| 45 | + * </ul> |
| 46 | + * |
| 47 | + * @author Andy Wilkinson |
| 48 | + * @author Stephane Nicoll |
| 49 | + * @since 1.3.0 |
| 50 | + * @deprecated since 4.0.0 for removal in 4.2.0 in favor of |
| 51 | + * {@link org.springframework.boot.EnvironmentPostProcessor} |
| 52 | + */ |
| 53 | +@FunctionalInterface |
| 54 | +@Deprecated(since = "4.0.0", forRemoval = true) |
| 55 | +public interface EnvironmentPostProcessor { |
| 56 | + |
| 57 | + /** |
| 58 | + * Post-process the given {@code environment}. |
| 59 | + * @param environment the environment to post-process |
| 60 | + * @param application the application to which the environment belongs |
| 61 | + */ |
| 62 | + void postProcessEnvironment(ConfigurableEnvironment environment, |
| 63 | + org.springframework.boot.SpringApplication application); |
| 64 | + |
| 65 | +} |
0 commit comments