Search in sources :

Example 1 with DeferredLogFactory

use of org.springframework.boot.logging.DeferredLogFactory in project spring-boot by spring-projects.

the class ConfigDataEnvironmentPostProcessor method applyTo.

/**
 * Apply {@link ConfigData} post-processing to an existing {@link Environment}. This
 * method can be useful when working with an {@link Environment} that has been created
 * directly and not necessarily as part of a {@link SpringApplication}.
 * @param environment the environment to apply {@link ConfigData} to
 * @param resourceLoader the resource loader to use
 * @param bootstrapContext the bootstrap context to use or {@code null} to use a
 * throw-away context
 * @param additionalProfiles any additional profiles that should be applied
 * @param environmentUpdateListener optional
 * {@link ConfigDataEnvironmentUpdateListener} that can be used to track
 * {@link Environment} updates.
 */
public static void applyTo(ConfigurableEnvironment environment, ResourceLoader resourceLoader, ConfigurableBootstrapContext bootstrapContext, Collection<String> additionalProfiles, ConfigDataEnvironmentUpdateListener environmentUpdateListener) {
    DeferredLogFactory logFactory = Supplier::get;
    bootstrapContext = (bootstrapContext != null) ? bootstrapContext : new DefaultBootstrapContext();
    ConfigDataEnvironmentPostProcessor postProcessor = new ConfigDataEnvironmentPostProcessor(logFactory, bootstrapContext, environmentUpdateListener);
    postProcessor.postProcessEnvironment(environment, resourceLoader, additionalProfiles);
}
Also used : DefaultBootstrapContext(org.springframework.boot.DefaultBootstrapContext) DeferredLogFactory(org.springframework.boot.logging.DeferredLogFactory)

Example 2 with DeferredLogFactory

use of org.springframework.boot.logging.DeferredLogFactory in project spring-boot by spring-projects.

the class ConfigDataEnvironmentPostProcessor method applyTo.

/**
 * Apply {@link ConfigData} post-processing to an existing {@link Environment}. This
 * method can be useful when working with an {@link Environment} that has been created
 * directly and not necessarily as part of a {@link SpringApplication}.
 * @param environment the environment to apply {@link ConfigData} to
 * @param resourceLoader the resource loader to use
 * @param bootstrapContext the bootstrap context to use or {@code null} to use a
 * throw-away context
 * @param additionalProfiles any additional profiles that should be applied
 */
public static void applyTo(ConfigurableEnvironment environment, ResourceLoader resourceLoader, ConfigurableBootstrapContext bootstrapContext, Collection<String> additionalProfiles) {
    DeferredLogFactory logFactory = Supplier::get;
    bootstrapContext = (bootstrapContext != null) ? bootstrapContext : new DefaultBootstrapContext();
    ConfigDataEnvironmentPostProcessor postProcessor = new ConfigDataEnvironmentPostProcessor(logFactory, bootstrapContext);
    postProcessor.postProcessEnvironment(environment, resourceLoader, additionalProfiles);
}
Also used : DefaultBootstrapContext(org.springframework.boot.DefaultBootstrapContext) DeferredLogFactory(org.springframework.boot.logging.DeferredLogFactory)

Aggregations

DefaultBootstrapContext (org.springframework.boot.DefaultBootstrapContext)2 DeferredLogFactory (org.springframework.boot.logging.DeferredLogFactory)2