Interface ConfigurationProvider


@Incubating public interface ConfigurationProvider
Allows integrators to provide their default configuration properties for various scopes that would override Hibernate Search specific ones.
  • Method Summary

    Modifier and Type
    Method
    Description
    Provide a configuration property source for the given scope.
    default int
    Defines a priority of a particular configuration provider.
  • Method Details

    • get

      Provide a configuration property source for the given scope.

      Property sources created by this provider must follow these rules:

      • A property source only contains properties that are relevant for the given scope. E.g. a global scope property source should not contain any configuration properties for a specific index with the backend.indexes.myindex prefix; if such a property is defined in a global scope source and then overridden in a backend/index scope (without the prefix), the value will be taken from the global source and backend/index ones will be silently ignored.
      • Property keys must be relative to the scope. No keys should start with hibernate.search. prefix. Assuming we want to redefine a property hibernate.search.backend.directory.type in the backend scope, then Hibernate Search would expect that the property source returned by this provider for a backend scope will contain a value for a directory.type key.
      • For global-scope property sources, the bean_configurers configuration property is only ever looked up if this provider was registered by a BeanConfigurer added through the Java ServiceLoader system. A provider registered by a BeanConfigurer added through the bean_configurers configuration property cannot itself set the bean_configurers configuration property.
      Parameters:
      scope - The scope for which configuration properties are about to be used.
      Returns:
      An empty optional if the provider does not need to override any Hibernate Search specific defaults for a provided scope, or a ConfigurationPropertySource with overrides otherwise.
    • priority

      default int priority()
      Defines a priority of a particular configuration provider.

      If multiple configuration providers are available they will be sorted by their priority and then by FQCN to guarantee a predictable order.

      Returns:
      The priority of the current provider.