Interface BeanStoreOverridable<B extends BeanStoreOverridable<B>>

Type Parameters:
B - The implementing builder's self type.
All Known Implementing Classes:
EncoderSet.Builder, Microservice.Builder, MockRestClient.Builder, MockRestClient.Builder, ParserSet.Builder, SerializerSet.Builder

public interface BeanStoreOverridable<B extends BeanStoreOverridable<B>>
Marker interface for builders that accept an overriding BeanStore — a layer whose entries take precedence over the builder's local bean registrations during construction-time reflective injection.

Implementing builders MUST install the supplied store in the overridingParent slot of the underlying BasicBeanStore (see BasicBeanStore(BeanStore, BeanStore)). The resulting bean-lookup order is:

  1. Overriding parent (the store passed to overridingBeanStore(BeanStore)) — wins for any (type, name) it knows about.
  2. The builder's local entries (e.g. @Bean factories declared on a @Rest resource, beans registered directly via addBean(...) / addSupplier(...)).
  3. The builder's regular parent bean store (e.g. a Spring ApplicationContext bridge), if any.
  4. Framework-default suppliers (registered via addDefaultSupplier(...)).

The primary use case is test-time bean substitution: a test builds a TestBeanStore-style overlay with mock beans, hands it to the builder via overridingBeanStore(BeanStore), and the system under test resolves the mocks at construction time without any reflection on the SUT itself. This is the Mode INJECT wiring pattern in the test-injection model — the overlay is installed before the SUT exists.

Example:

var overlay = new TestBeanStore().override(MyService.class, mockSvc); var serializers = SerializerSet.create() .overridingBeanStore(overlay) .add(JsonSerializer.class) .build();

Why a self-typed interface:

The B extends BeanStoreOverridable<B> self-type lets the method return the concrete builder type rather than BeanStoreOverridable<?>, preserving the fluent chain at the call site:

SerializerSet.Builder builder = SerializerSet.create() .overridingBeanStore(overlay) // still SerializerSet.Builder, not BeanStoreOverridable<?> .add(JsonSerializer.class); // fluent chain preserved

See Also:
  • BeanStore - The base lookup interface this layer extends.
  • BasicBeanStore - The default writable implementation with the overridingParent slot.
Since:
10.0.0
  • Method Summary

    Modifier and Type
    Method
    Description
    Installs the supplied BeanStore as the overridingParent of the underlying bean store used by this builder during construction-time reflective injection.
  • Method Details

    • overridingBeanStore

      Installs the supplied BeanStore as the overridingParent of the underlying bean store used by this builder during construction-time reflective injection.

      Passing null clears any previously-installed overlay.

      Parameters:
      store - The override layer. Can be null to clear a previously-set value.
      Returns:
      This object.
      Since:
      10.0.0