Class ApplicationContextBuilder

java.lang.Object
net.shibboleth.shared.spring.util.ApplicationContextBuilder

public class ApplicationContextBuilder extends Object
Fluent builder for a FilesystemGenericApplicationContext equipped with various standard features, behavior, converters, etc. that are applicable to the Shibboleth software components.
Since:
5.4.0
  • Field Details

    • log

      @Nonnull private final org.slf4j.Logger log
      Class logger.
    • contextName

      @Nullable @NotEmpty private String contextName
      Context name.
    • configurationSources

      @Nullable private List<String> configurationSources
      Unresolved configuration sources for this service.
    • configurationResources

      @Nullable private List<Resource> configurationResources
      Configuration resources for this service.
    • conversionService

      @Nullable private ConversionService conversionService
      Conversion service to use.
    • contextInitializers

      @Nullable private List<ApplicationContextInitializer<? super FilesystemGenericApplicationContext>> contextInitializers
      List of context initializers.
    • factoryPostProcessors

      @Nullable private List<BeanFactoryPostProcessor> factoryPostProcessors
      List of bean factory post processors for this service's content.
    • postProcessors

      @Nullable private List<BeanPostProcessor> postProcessors
      List of bean post processors for this service's content.
    • propertySources

      @Nullable private List<PropertySource<?>> propertySources
      List of property sources to add.
    • beanProfiles

      @Nullable private Collection<String> beanProfiles
      Bean profiles to enable.
    • parentContext

      @Nullable private ApplicationContext parentContext
      Application context owning this engine.
    • installShutdownHook

      private boolean installShutdownHook
      Whether to install a JVM shutdown hook.
  • Constructor Details

    • ApplicationContextBuilder

      public ApplicationContextBuilder()
  • Method Details

    • setName

      @Nonnull public ApplicationContextBuilder setName(@Nullable @NotEmpty String name)
      Set the name of the context.
      Parameters:
      name - name
      Returns:
      this builder
    • setConversionService

      @Nonnull public ApplicationContextBuilder setConversionService(@Nullable ConversionService service)
      Set a conversion service to use.
      Parameters:
      service - conversion service
      Returns:
      this builder
    • setServiceConfiguration

      @Nonnull public ApplicationContextBuilder setServiceConfiguration(@Nonnull Resource config)
      Set a single configuration resource for this context.
      Parameters:
      config - configuration for this context
      Returns:
      this builder
    • setUnresolvedServiceConfigurations

      @Nonnull public ApplicationContextBuilder setUnresolvedServiceConfigurations(@Nonnull Collection<String> configs)
      Set the unresolved configurations for this context.

      This method is used to allow the context to resolve the resources.

      Parameters:
      configs - unresolved configurations for this context
      Returns:
      this builder
      Since:
      7.0.0
    • setServiceConfigurations

      @Nonnull public ApplicationContextBuilder setServiceConfigurations(@Nonnull Collection<Resource> configs)
      Set the configurations for this context.
      Parameters:
      configs - configurations for this context
      Returns:
      this builder
    • setPropertySources

      @Nonnull public ApplicationContextBuilder setPropertySources(@Nonnull List<PropertySource<?>> sources)
      Set additional property sources for this context.
      Parameters:
      sources - property sources to add
      Returns:
      this builder
    • setContextInitializer

      @Nonnull public ApplicationContextBuilder setContextInitializer(@Nonnull ApplicationContextInitializer<? super FilesystemGenericApplicationContext> initializer)
      Set a single context initializer for this context.
      Parameters:
      initializer - initializer to apply
      Returns:
      this builder
    • setContextInitializers

      @Nonnull public ApplicationContextBuilder setContextInitializers(@Nonnull List<ApplicationContextInitializer<? super FilesystemGenericApplicationContext>> initializers)
      Set the list of context initializers for this context.
      Parameters:
      initializers - initializers to apply
      Returns:
      this builder
    • setBeanFactoryPostProcessor

      @Nonnull public ApplicationContextBuilder setBeanFactoryPostProcessor(@Nonnull BeanFactoryPostProcessor processor)
      Set a single bean factory post processor for this context.

      Note that if this object is ApplicationContextAware or EnvironmentAware, that is injected by the builder. Do NOT pass in processors that already contain references to a parent context.

      Parameters:
      processor - bean factory post processor to apply
      Returns:
      this builder
    • setBeanFactoryPostProcessors

      @Nonnull public ApplicationContextBuilder setBeanFactoryPostProcessors(@Nonnull List<BeanFactoryPostProcessor> processors)
      Set the list of bean factory post processors for this context.

      Note that if these objects are ApplicationContextAware or EnvironmentAware, that is injected by the builder. Do NOT pass in processors that already contain references to a parent context.

      Parameters:
      processors - bean factory post processors to apply
      Returns:
      this builder
    • setBeanPostProcessor

      @Nonnull public ApplicationContextBuilder setBeanPostProcessor(@Nonnull BeanPostProcessor processor)
      Set a single bean post processor for this context.

      Note that if this object is ApplicationContextAware or EnvironmentAware, that is injected by the builder. Do NOT pass in processors that already contain references to a parent context.

      Parameters:
      processor - bean post processor to apply
      Returns:
      this builder
    • setBeanPostProcessors

      @Nonnull public ApplicationContextBuilder setBeanPostProcessors(@Nonnull List<BeanPostProcessor> processors)
      Set the list of bean post processors for this context.

      Note that if these objects are ApplicationContextAware or EnvironmentAware, that is injected by the builder. Do NOT pass in processors that already contain references to a parent context.

      Parameters:
      processors - bean post processors to apply
      Returns:
      this builder
    • setBeanProfiles

      @Nonnull public ApplicationContextBuilder setBeanProfiles(@Nonnull Collection<String> profiles)
      Set the bean profiles for this context.
      Parameters:
      profiles - bean profiles to apply
      Returns:
      this builder
    • setParentContext

      @Nonnull public ApplicationContextBuilder setParentContext(@Nullable ApplicationContext context)
      Set the parent context.
      Parameters:
      context - parent context
      Returns:
      this builder
    • installShutdownHook

      @Nonnull public ApplicationContextBuilder installShutdownHook(boolean flag)
      Set whether to install a JVM shutdown hook.

      Defaults to false.

      Parameters:
      flag - flag to set
      Returns:
      this builder
      Since:
      7.0.0
    • build

      @Nonnull public GenericApplicationContext build()
      Build a GenericApplicationContext context.
      Returns:
      the built context, initialized and loaded