The new BeanRegistrar interface introduced in #18353 is not only suitable for @Import usage on a @Configuration class but also for encapsulated pieces of programmatic registration that can be applied to any GenericApplicationContext. A register(BeanRegistrar...) method on GenericApplicationContext makes this obvious.