Interface ConfigProviderCustomizer


@API(status=STABLE, since="1.0") public interface ConfigProviderCustomizer
Interface for available Config instances customization on current Spring context. Allows customizing the ConfigProvider used when enabling Config injection with EnableOrneConfig or configurable components with EnableConfigurableComponents.

By default a Spring enviromnent based configuration is used as the default configuration, and all other available Config instances in the Spring context are registered as additional configurations.

To customize this behavior implement this interface as a Spring bean, and provide a default Config instance:

 @Configuration
 class MyConfig implements ConfigProviderCustomizer {
 
     @Override
     public Config configureDefaultConfig(
             final Map<String, Config> configs) {
         // Return the desired default configuration
     }
 }
 
To customize the additional configurations registration override the #registerAdditionalConfigs(ConfigProviderBuilder, Map) method.

Only one implementation of this interface is allowed per Spring context, and it's not inherited by child contexts.

Since:
1.0
Version:
1.0, 2025-11
Author:
(w) Iker Hernaez
See Also:
  • Method Details

    • configureDefaultConfig

      @NotNull @NotNull Config configureDefaultConfig(@NotNull @NotNull Map<String,Config> configs)
      Configures the default Config instance.
      Parameters:
      configs - The configurations available in the Spring context.
      Returns:
      The default configuration.
    • registerAdditionalConfigs

      default void registerAdditionalConfigs(@NotNull @NotNull ConfigProviderCustomizer.ConfigRegistry registry, @NotNull @NotNull Map<String,Config> configs)
      Registers additional Config instances.
      Parameters:
      registry - The registry of additional configurations.
      configs - The configurations available in the Spring context.