BeanConfigurer typedef

BeanConfigurer = void Function(Object bean, DependencyResolver resolver)

A function that injects the dependencies of an object the container did not create, an instance of a @Configurable class.

The generator writes one per @Configurable class and the module registers it with DefaultListableBeanFactory.registerConfigurer; autowireBean then finds it by the object's runtime type. You write one only for a factory used without generated modules.

// How a ProfileScreenState gets its Profiles bean.
factory.registerConfigurer(
  ProfileScreenState,
  (bean, r) =>
      (bean as ProfileScreenState).profiles = r.dependency<Profiles>(),
);

Spring (Java): no counterpart; Spring injects @Configurable objects by reflection (AspectJ weaving or autowireBean).

Implementation

typedef BeanConfigurer = void Function(
  Object bean,
  DependencyResolver resolver,
);